GaZaTu / x11-emoji-picker

Linux XServer emoji picker
MIT License
203 stars 6 forks source link

please move recent emoji out of config file #13

Closed asymmetricia closed 2 years ago

asymmetricia commented 2 years ago

hi!

I would like to configuration-manage (i.e., with ansible) the config for x11-emoji-picker. At present this means that I'll lost my recently used emoji each time I do so.

Could recent emoji be stored in its own dedicated file?

(Might offer a PR for this later, but if it's an easy fix for you and agree, please don't wait for me!)

Thanks!

GaZaTu commented 2 years ago

i always hated storing recently used emojis in the config (was just too lazy to fix it).

i'll look into it tomorrow. 😋

GaZaTu commented 2 years ago

is #14 what you had in mind? @asymmetricia

you can test it by using one of the artifacts in https://github.com/GaZaTu/x11-emoji-picker/actions/runs/1684899318

asymmetricia commented 2 years ago

This looks about right, but n.b., it doesn't appear to be actually populating recent emoji to the new location, and in addition it is still rewriting the config location to include, as opposed to leaving that section out entirely.

[recentEmojis]
size=0
GaZaTu commented 2 years ago

how about https://github.com/GaZaTu/x11-emoji-picker/actions/runs/1689606261 @asymmetricia ? 😂 storing to the new file should work tho, if it still doesn't: could you check what the content of ~/.cache/gazatu.xyz/emoji-picker/cache.ini is?

asymmetricia commented 2 years ago

I removed cache & config:

$ rm -rf ~/.cache/gazatu.xyz ~/.config/gazatu.xyz/

Then ran the new emoji-picker, and checked the cache & config files:

$ cat ~/.cache/gazatu.xyz/emoji-picker/cache.ini
[General]
version=0.8.2

[recentEmojis]
size=0
cat ~/.config/gazatu.xyz/emoji-picker.ini 
[General]
activateWindowBeforeWritingByDefault=false
aliasExactMatching=false
customQssFilePath=
enableEmojiIncludesSearch=true
gendersDisabled=false
hideInputMethod=false
localeKey=
maxEmojiVersion=-1
openAtMouseLocation=false
skinTonesDisabled=false
surroundAliasesWithColons=true
swapEnterAndShiftEnter=false
useClipboardHackByDefault=false
useSystemQtTheme=false
windowOpacity=0.9

[activateWindowBeforeWritingExceptions]
1\processName=code
2\processName=code-oss
3\processName=chrome
4\processName=chromium
5\processName=kate
6\processName=brave
size=6

[emojiAliasesIniFilePaths]
1\path=:/aliases/github-emojis.ini
2\path=:/aliases/gitmoji-emojis.ini
size=2

[useClipboardHackExceptions]
1\processName=chatterino
2\processName=kate
size=2

So, it does look like it's gone from config.ini, but I'm still not seeing it actually populate cache.ini.

GaZaTu commented 2 years ago

with "ran" you mean you wrote an emoji into some app?

asymmetricia commented 2 years ago

yep! two, in fact. image

GaZaTu commented 2 years ago

installed a fresh debian VM with gnome and couldn't reproduce. @zneix couldn't reproduce this on his arch setup either.

what OS / WM / DE are you using? 😅 @asymmetricia

asymmetricia commented 2 years ago

Debian with pekwm, no desktop environment. Let me see if I can get a debugger wired up.

asymmetricia commented 2 years ago

n.b., I'm currently able to reproduce when selecting + closing with shift+enter, but it does work fine with enter and then, later, escape.

asymmetricia commented 2 years ago

enter + escape

$ gdb ./emoji-picker 
Reading symbols from ./emoji-picker...
(gdb) set substitute-path /work .
(gdb) break EmojiPicker::onEscapePressed
Breakpoint 1 at 0x7b5aa1: file /work/src/EmojiPicker.cpp, line 437.
(gdb) run
Starting program: emoji-picker 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff28f5640 (LWP 469375)]
[New Thread 0x7ffff20bc640 (LWP 469376)]
[New Thread 0x7ffff096f640 (LWP 469378)]

Thread 1 "emoji-picker" hit Breakpoint 1, EmojiPicker::onEscapePressed (this=0x555556ab14f0, event=...) at /work/src/EmojiPicker.cpp:437
437   EmojiPickerSettings().setRecentEmojis(_recentEmojis);
(gdb) cont
Continuing.
[Thread 0x7ffff28f5640 (LWP 469375) exited]
[Thread 0x7ffff096f640 (LWP 469378) exited]
[Thread 0x7ffff20bc640 (LWP 469376) exited]
[Inferior 1 (process 469371) exited normally]

with shift+enter (same session, breakpoint still exists):

(gdb) run
Starting program: /home/pdbogen/src/x11-emoji-picker/emoji-picker 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff28f5640 (LWP 469798)]
[New Thread 0x7ffff20bc640 (LWP 469799)]
[New Thread 0x7ffff096f640 (LWP 469833)]
[Thread 0x7ffff28f5640 (LWP 469798) exited]
[Thread 0x7ffff096f640 (LWP 469833) exited]
[Thread 0x7ffff20bc640 (LWP 469799) exited]
[Inferior 1 (process 469797) exited normally]

So code in onEscapePressed is not getting called.

asymmetricia commented 2 years ago

If this were Go, I'd guess there's a race condition between the program exiting and that last emit getting handled. Is that possible here?

GaZaTu commented 2 years ago

huh you're right, never noticed that behavior

zneix commented 2 years ago

I can confirm that after pressing Shift+Enter, the application inserts the emoji just fine, file ~/.cache/gazatu.xyz/emoji-picker/cache.ini gets created and even gets written however [recentEmojis]size is equal to 0. Just pressing Enter to insert emoji works fine and [recentEmojis] section gets updated

zneix commented 2 years ago

Just tested master branch and can say that list of recently used emojis in [recentEmojis] in ~/.config/gazatu.xyz/emoji-picker.ini does not get updated either after pressing Shift+Enter to select an emoji. Given that, I can say this is a bug that existed prior #14 and that the PR is fine to be merged in and this issue we've just found is to be fixed in another patch. @gazatu, what do you think?

GaZaTu commented 2 years ago

uhh sure i guess