-
Notifications
You must be signed in to change notification settings - Fork 27
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
Rofi not giving back focus before clipboard adapter script runs, making inserts fail, on Wayland / River #53
Comments
Interesting. This could be a Wayland-specific issue, which means I would require more help in trying to fix it. The plugin will tell Rofi to hide the main window before executing the script, so the focus should be restored. The fact that the window still shows up for you might mean that Rofi doesn't actually hide the window on Wayland when this function is called. In theory it could also be an issue with River itself. I wonder if another Wayland implementation suffers from the same issue… 🤔 That's all I can contribute on this by myself, I'm afraid. I'll tag this as a Help Needed issue to see if there might be someone else on Wayland that has a clue on what to look at. |
I have just checked the source code for https://github.com/Mange/rofi-emoji/blob/master/src/actions.c , and it also seems that the only reason for But in So maybe it can be fixed in rofi-emoji in an universal way, without requiring any wayland knowledge, by running clipboard-adapter and returning I guess that would involve creating another method in https://github.com/Mange/rofi-emoji/blob/master/src/utils.c next to |
I've also checked So my guess is that, when rofi-emoji worked on my system, it was because it was running under xwayland. I don't know what changed, but now it runs natively (or at least |
Good guess, but not quite. 😄 It's also due to the asynchronous nature of the process communication. We have to:
We could work around this by spawning the process, and detach from it, but it might lead to other problems. I think the complexity might not be worth it, sadly.
Yeah, which is a shame. It makes it harder to debug any script errors, but Rofi has cleaned up a lot at this point and cannot be restored. |
But also it's just a single emoji. Makes me wonder what was the reason for reading input from stdin instead from an argument. I see that you did it before in #13 (and according to the description, it simplified things a lot), but returned to stdin in the "total feature rewrite" in #44 . Just curious why :) because PR description does not explain this. |
It just makes it simpler to compose it in other scripts, and for example when I wanted to be able to copy other things like the codepoint. We could also add support for accumulating multiple emojis and copy them all at once. Some of the issues would not go away even if we went with arguments. We still need to wait for the process to finish in order to reap it. Maybe trying a Wayland-compatible fork of Rofi could yield some good results…? |
Using |
The same happens on |
I don't think this is a good solution but, I run #!/bin/sh
case "$ROFI_RETV" in
"10") echo "$1" | cliphist delete;;
"11") echo "$1" | cliphist decode | wl-copy;;
"1") pkill rofi; wtype "$(echo "$1" | cliphist decode)"; exit;;
esac
printf "\x00use-hot-keys\x1ftrue\n\x00no-custom\x1ftrue\n"
cliphist list |
I'm now on Wayland myself (Hyprland to be specific), and for me it actually works in some programs without modification, and not at all in some other programs.
Even when running It seems to me that things based on Chromium/Electron won't work, but "native" apps using GTK, QT, etc. works as expected. Feel free to test this yourself. Here's the different variants I did: PatchesVanilla case "$tool" in
# …
wtype)
wtype -
;;
# … pkill case "$tool" in
# …
wtype)
to_type="$(cat -)"
pkill rofi
wtype "$to_type"
;;
# … Async case "$tool" in
# …
wtype)
to_type="$(cat -)"
(
sleep 1
wtype "$to_type"
) &
exit 0
;;
# … I anyone else getting different results? Can you send emojis to these programs using |
I've found some issues upstream to read more at:
This all leads me to believe that the issue is not in this repo, but in some programs and how they handle keyboard input from Wayland. |
After I installed rofi-emoji on my Alpine with wayland and river, it worked fine for some time, and then it stopped working at some point.
I've checked that clipboard-adapter works:
I've also added debug statements to
/usr/share/rofi-emoji/clipboard-adapter.sh
:before the call to
perform_copy
, and logs are identical both for riverctl spawn 'echo "😀" | /usr/share/rofi-emoji/clipboard-adapter.sh insert' (which works), and forrofi -modi emoji -show emoji
invoked with river hotkey.Similarly, logs are identical for
echo "😀" | /usr/share/rofi-emoji/clipboard-adapter.sh insert
androfi -modi emoji -show emoji
invoked from shell.However, no emojis are actually inserted with rofi-emoji (they're copied to clipboard though).
My only guess now is that maybe the focus is somewhere in the wrong place for rofi-emoji.
I've also tried adding
sleep 5
inclipboard-adapter.sh
right before the call to perform_insert, and now the emoji selector stays on the screen for these five seconds, implying that maybe the focus is on the emoji selector, and it tries to insert the emoji into itself? But maybe my guess is wrong.The text was updated successfully, but these errors were encountered: