Skip to content

Paste selected emoji using ydotool on Wayland#161

Open
ZimbiX wants to merge 2 commits intotom-james-watson:masterfrom
ZimbiX:wayland-paste
Open

Paste selected emoji using ydotool on Wayland#161
ZimbiX wants to merge 2 commits intotom-james-watson:masterfrom
ZimbiX:wayland-paste

Conversation

@ZimbiX
Copy link
Copy Markdown

@ZimbiX ZimbiX commented Aug 21, 2024

Resolves #157.

Related: #44.

ydotool must be installed with ydotoold running

The key codes for Ctrl+Shift+V in the command are from /usr/include/linux/input-event-codes.h. :1 means key down, :0 means key up

Edit: Tested in Gnome Shell on Arch Linux

@tom-james-watson
Copy link
Copy Markdown
Owner

Hello, thanks for your interest.

We can't just rely on the user having certain system packages installed, unfortunately. Xdotool is bundled with the app already, built into the snap and flatpak packages.

The problem with ydotool is that it requires a daemon that needs to run as root and when I looked at this previously I could not find a way to get a flatpak or snap to be configured to run privileged code like that. That's the actual hard part - if someone can work out that part then the actual usage of ydotool is simple enough.

Please see the past PRs related to this for more context: https://github.com/tom-james-watson/Emote/pulls?q=is%3Apr+ydotool

@vemonet
Copy link
Copy Markdown
Collaborator

vemonet commented Oct 16, 2024

ydotool is not the best approach as @tom-james-watson mentioned it requires too many permissions

I have investigated this a bit and this should be already possible to do properly on wayland with the XDG portals and libei "library for Emulated Input", but the available lib, docs and implementation are still a bit rough (thanks wayland for such a well thought and well documented protocol \s)

You can find more details and links here: https://github.com/vemonet/EmojiMart?tab=readme-ov-file#%EF%B8%8F-todo

There seems to be a library for libei python bindings here: https://gitlab.freedesktop.org/libinput/snegg

Personally I don't have the time to struggle with this (and I am still on x11 anyway, everytime I try wayland everything just breaks stutters all over the place, professional screenshare impossible, I don't know how people can actually use it)

@ZimbiX

@vasi
Copy link
Copy Markdown

vasi commented Dec 26, 2024

@tom-james-watson What would you think of the approach of allowing the user to choose an auto-paste command? That would let us wait for Wayland-based solutions to mature before building anything into Emote—while advanced users could experiment with wtype, ydotool, some new libei-based solution, etc. Maybe it could be a hidden preference.

@tom-james-watson
Copy link
Copy Markdown
Owner

Seems reasonable, I guess. I'm not working on emote anymore really though, but would accept a good PR!

@sarowarhosen03
Copy link
Copy Markdown

@tom-james-watson What would you think of the approach of allowing the user to choose an auto-paste command? That would let us wait for Wayland-based solutions to mature before building anything into Emote—while advanced users could experiment with wtype, ydotool, some new libei-based solution, etc. Maybe it could be a hidden preference.

emote isn't perfectly working on wayland

@vemonet
Copy link
Copy Markdown
Collaborator

vemonet commented Feb 25, 2025

https://gist.github.com/probonopd/9feb7c20257af5dd915e3a9f2d1f2277

Despite what some people try to make you think Wayland is not ready for serious use. After 10 years development we barely start to have APIs for clipboard and screen sharing, which are really basic and should have been thought of day 1.

@sarowarhosen03
Copy link
Copy Markdown

https://gist.github.com/probonopd/9feb7c20257af5dd915e3a9f2d1f2277

Despite what some people try to make you think Wayland is not ready for serious use. After 10 years development we barely start to have APIs for clipboard and screen sharing, which are really basic and should have been thought of day 1.

yaah now i'm shift into this extension
image

@MorsMortium
Copy link
Copy Markdown

The AUR patch, that I used on wayland without any issue for 2 years, has this line:

os.system('bash -c "sleep 0.15; ydotool key 29:1 47:1 47:0 29:0" &')

29 being ctrl and 47 being v.
I can make a PR with lifting that sleep from the ifs and then only having the ydotool comman in os.system, to make it a bit cleaner. @tom-james-watson

@nonZero
Copy link
Copy Markdown

nonZero commented Oct 29, 2025

Related: https://git.sr.ht/~geb/dotool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasting in Wayland redux

7 participants