Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste selected emoji using ydotool on Wayland #161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Launch the emoji picker with the configurable keyboard shortcut `Ctrl+Alt+E`, an

- ⚡️ Emote [shows up faster](https://github.com/tom-james-watson/Emote/issues/54) when invoked using the built-in keyboard shortcut (`Ctrl+Alt+E` by default), than when using a manually registered keyboard shortcut.
- 🪟 Emote under Wayland cannot automatically paste the emoji into other apps, and also requires manual registering of a global keyboard shortcut - [Hotkey In Wayland](https://github.com/tom-james-watson/Emote/wiki/Hotkey-In-Wayland). This is due to intentional restrictions in the design of Wayland itself.
- Pasting on X11 requires [`xdotool`](https://github.com/jordansissel/xdotool), and on Wayland requires [`ydotool`](https://github.com/ReimuNotMoe/ydotool).

<p align="center">
<img width="500" src="https://raw.githubusercontent.com/tom-james-watson/Emote/master/images/screenshot.png">
Expand Down
6 changes: 5 additions & 1 deletion emote/picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,11 @@ def on_emoji_select(self, emoji):

self.destroy()

if not config.is_wayland:
if config.is_wayland:
# Paste using Ctrl+Shift+V so it also works in a terminal
# Sleeping in the system process and backgrounding it avoids the sleep happening synchronously before the Emote window closes
os.system("bash -c 'sleep 0.15; ydotool key 29:1 42:1 47:1 47:0 42:0 29:0' &")
else:
time.sleep(0.15)
os.system("xdotool key ctrl+v")

Expand Down