gentakojima / emojione-picker-ubuntu

Emoji picker for Ubuntu based on icons by Emojione
238 stars 14 forks source link

[feature] paste on click #17

Open MightyPork opened 8 years ago

MightyPork commented 8 years ago

Working great, but would be much better if the emoji got pasted into the currently active window instead of being copied to clipboard.

You should be able to simply do it with xdotool type "👍" - might actually try hacking that in myself 😄

MightyPork commented 8 years ago

Turns out simply adding subprocess.Popen(["xdotool", "key", "Control_L+V"]) after storing it in the clipboard is more reliable

gentakojima commented 7 years ago

I'm using "xdotool type" method, which seems to be more reliable for me. You must enable this behaviour in the settings. Please test it out and comment on how it went.

orzechow commented 7 years ago

Actually that's a feature I'd expect to be the intention of this picker. To be honest, after installing I thought the picker is not working at all, until i saw this issue and realized that its function is clipboard only... (should have read the "How to use it")

gentakojima commented 7 years ago

@orzechow the notification didn't bring up your attention? The feature is now implemented but still not in the PPA version. You must enable it in the settings.

protist commented 7 years ago

I tested this on the following system.

In general, emojione-picker-ubuntu works very well in Plasma, but the xdotool feature is a bit buggy. I tested it in vim, and it only worked 3/10 times. The rest of the time it didn't do anything.

The intermittent nature suggested it might have been some kind of race condition, so I attempted extended the sleep to 0.2, then 0.5. However, in both cases, it now fails ~9/10 times.

It's odd, because on my system, I have two other shortcuts bound to xdotool commands, and both work 100% of the time, with no sleep required.

sh -c 'xdotool type --clearmodifiers -- "$(xsel -o)"; xdotool keyup Super_L'
sh -c 'xdotool type --clearmodifiers -- $(date +%y%m%d | tr "\\n" " ")'

I definitely think that using xdotool to type the emoji directly is more elegant than typing Ctrl+v, but I tested that alternative anyway. I had to use a slightly different key combination, and placed this line just after the clipboard is assigned.

    subprocess.Popen(["xdotool", "key", "ctrl+v"])

However, this worked for me for 10/10 attempts. I'm happy to troubleshoot the direct method too.

GregDMeyer commented 7 years ago

One note--maybe it should be mentioned somewhere (or checked, when selecting "autopaste" in the settings) to make sure that xdotool is installed. it took me a few thrown exceptions to realize why it wasn't working.