x11-emoji-picker
x11-emoji-picker copied to clipboard
xfce4/xfwm4: Set focus even if active window is on top and "Prevent focus stealing" option is turned on
The emoji picker sets focus and I can type starting when I launch it but only when the previously focused window is not on top (I use wmctrl -r :ACTIVE: -b toggle,above
to toggle that). I would like to have an option to make the emoji-picker take the focus even when the currently active window is on top.
I'm on Arch using Xfce4/xfwm4.
ok first thoughts: I could not reproduce this when running wmctrl -r :ACTIVE: -b toggle,above
on Konsole
with my Manjaro/KDE machine; the emoji picker was still able to input text and it was infront of Konsole
aswell.
I'll have to install Xfce4 i guess.
Yeah, in my case the picker does open above but the input focus stays at the old window (which means that I have to click on the picker window before I can start searching for emojis...). But it should work on Xfce4/xfwm4: I wrote a small app by using xlib which launches a window and I can successfully raise and then set focus to the window and it works, no matter whether the previously focused window was on top or not.
i'm actually a bit confused because i can't get the emoji picker to work at all with Xfce4 😅 As in, it starts but doesn't input anything regardless of target app and input method.
Edit: but ignoring this fact, i still can't reproduce this issue after running wmctrl -r :ACTIVE: -b toggle,above
on Terminal
ok this pic doesn't say much now that think about it xd
Edit2: fyi I used the Keyboard
section in Settings Manager
to register the emoji picker keybind
@schrmh what if you try https://github.com/GaZaTu/x11-emoji-picker/actions/runs/2157840101 (the .AppImage whenever it's done) 🤔
@GaZaTu It can't send emojis to some TE's (including xfce4-terminal, lol) but elsewhere it "works". Well, at least how I described it. You can also watch this gif (I use xfce4-terminal to demonstrate it but that doesn't matter for the focus issue):
(At first the focused xfce4-terminal is on top other windows and after pressing a shortcut it is below other windows)
Regarding the AppImage, I tried the new version from build #94 and looked at your change. raise is not enough. I also tried activateWindow and a few other options but nothing seems to work so far. activateWindow actually seems to use XSetInputFocus under the hood so I wonder why it doesn't work when XSetInputFocus works in my test app.
I manage my shortcuts using the same app within Xfce.
So what I noticed:
I had "Prevent focus stealing" which lead to the case that wmctrl -a
did not work (fun fact: ChatGPT gave me a hint there to take a look at xfwm4-tweaks-settings).
One might think now that disabling this solves the problem here but without the option the emoji picker doesn't get focus no matter if xfce4-terminal is on top or not... :D
Okay, actually.... When I try it with my local copy which still is at 7650a30914fc4fe0ca332d7674f9206bef408e4e it works as expected when "Prevent focus stealing" is turned off. While the AUR packages (one pulls from the repo) and the AppImage don't work / do what I wrote in the previous comments (aka no focus to the emoji-picker window at all).
However, without re-changing code the current emoji-picker can be used when devilspie sets focus to it and then it works again (as long as the focus loss prevention option is turned off in xfce4/xfwm4. When that is on, there is still the initial behavior reported in this issue).