efck-chat-keyboard / efck

Emoji filter / Unicode chat keyboard
https://efck-chat-keyboard.github.io
GNU Affero General Public License v3.0
26 stars 2 forks source link

Override clipboard command (on KDE/Wayland) #22

Open rochacbruno opened 5 months ago

rochacbruno commented 5 months ago

I really this app, this is the best option I have found for emoji picker on KDE, way better yhan the KDE integrated emoji picker.

However it is difficult to make it work on wayland, because wtype is not supported with some compositors and also I dont want to run ydotool as a service.

So my use case is simple:

1 Fixing wtype compositor problem

Install CopyQ, it works on wayland and also X, and is good fit any DE. On my Arch I dis with sudo pacman -S copyq

Copyq has a GUI interface, but we are only interested in the CLI it allows to add things to clipboard

As efck expects wtype and there is no way YET to customize the clipboard manager, we need to use a workaround

Create a file called wtype on your local bin ~/.local/bin/ or ~/bin

#!/usr/bin/env sh
copyq copy $1

chmod +x on it.

And that is it!

Map some keybinding to efck and it will call your script to add emoji selection to clipboard.

RFC

Make it possible to customize the clipboard command, so I can pass ["copyq", "copy"]

Btw: Thanks for this great tool!

kernc commented 5 months ago

Thanks for the kind words! 😊

So first of all, are you saying that if you check Force clipboard on the Options tab, it doesn't put the characters in your clipboard on KDE?

Because we use the Qt mechanism for that ...

https://github.com/efck-chat-keyboard/efck/blob/b695b8a3b4f3ce280b5f5ed5e5e9a84f884d0cdb/efck/output.py#L45-L57

and that would indicate that QClipboard doesn't support Wayland. 🤔

Apparently due to complexity and workarounds, the window needs to be focused in order for clipboard to work.

Can you just for completeness try launching efck with export QT_QPA_PLATFORM=xcb?

But I agree, commands might need to be overridden. Of all the different options for it, inspired by your example, I'm leaning towards simply invoking well-known efck-chat-keyboard-typecmd and efck-chat-keyboard-copycmd if available in $PATH. What do you think?