-
Notifications
You must be signed in to change notification settings - Fork 39
fix: do not use clipboard on X11 #42
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
Conversation
Maybe wtype could be used for Wayland, but I can't test that. |
emote/picker.py
Outdated
os.system("xdotool key ctrl+v") | ||
emojis = "".join(self.emoji_append_list) | ||
if not config.is_wayland and self.current_window: | ||
os.system(f"xdotool windowfocus '{self.current_window}' type --args 1 '{emojis}'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks.
type
alone after the sleep didn't work; indeed, the picker window stuck around so I think it received thetype
.- By explicitly targetting the window that was active before the picker came up, we can do away with the
sleep
. - Using
windowfocus
becausetype --window
doesn't (always) work (neither here nor from the shell); cf. sectionSENDEVENT NOTES
inman xdotool
.
Hello - thanks for your contribution! I looked into this previously and there's no reliable way to do this on Wayland unfortunately. See atx/wtype#22 for why I think a better version of what you're trying to do would be to keep the app working the same as it does now, but then to copy back the original clipboard contents after pasting. However at the moment the app also has some features that are designed around clipboard use. As an example, you can open the app, right click several emojis and then close the app with I think if we were to change to restoring clipboard contents after pasting, the app would require some UX tweaks to make it so that the only way to interact with the app is to "finalize" a selection in a way that performs a paste. I would imagine that would also break some flows though where people are relying on having the emojis hang around in their clipboard. |
result = subprocess.run( | ||
['xdotool', 'getactivewindow'], | ||
capture_output = True, | ||
check = True | ||
) | ||
return result.stdout.decode("utf-8").strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on what versions of python are supported, it might be easier to use subprocess.check_output()
with text=True
.
|
||
def add_emoji_to_recent(self, emoji): | ||
user_data.update_recent_emojis(emoji) | ||
emojis.update_recent_category() | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should probably be reverted.
I just installed Emote from the AUR. It took some manual work to apply the patch, ugly but works 😂 In case this helps anyone, I performed these steps:
`PKGBUILD` diffdiff --git a/PKGBUILD b/PKGBUILD
index 780b156..79be016 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,11 +14,13 @@ source=(
"https://github.com/tom-james-watson/Emote/archive/${_pkgref}.tar.gz"
'setup.py'
'fix-skin-tone-static-path.patch'
+ 'pull-42.patch'
)
sha512sums=(
'SKIP'
'ef8caea8ad9e9bc0487dd8c816561027adda743c1e8e2779a64e7ae99fb227c820f31ef9c87fb910bae7a8ffc623e5e2e1a53a8c69ce0a35ad96557e97a5a949'
'52d3dce0cecfe62ccc4469b4b35b27c8332d6dce2d1e2dd5603c85a3025fb4a415df303eaaace5579c4204923cbd8d86846deb1026a01f8b201452453c61746f'
+ 'SKIP'
)
build() {
@@ -26,6 +28,8 @@ build() {
mv -f "$srcdir/setup.py" "$srcdir/Emote-$_pkgref/setup.py"
# Fix skin tone and `static/` path issues when not running as a snap
patch -d "$srcdir/Emote-$_pkgref" -p1 <"$srcdir/fix-skin-tone-static-path.patch"
+ # Apply patch from https://github.com/tom-james-watson/Emote/pull/42
+ patch -d "$srcdir/Emote-$_pkgref" -p1 <"$srcdir/pull-42.patch"
# Move static files into the library
mv -T "$srcdir/Emote-$_pkgref/static" "$srcdir/Emote-$_pkgref/emote/static"
# Fix .desktop file
@reitzig If I split the command and remove the sleep (see mpsijm@patch-1), I'm getting good results in Firefox, Chrome, Telegram, Slack, Gedit, and Xfce4 Terminal 😄 No characters swallowed yet, but then again, I just installed the tool. 😛 I'll report later if I find an app for which it doesn't work. 🙂 EDIT: LibreOffice (tested with Writer and Calc) does seem to swallow characters, but not consistently, with or without sleep 😅 |
Implements #41 for X11.