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

xfce4/xfwm4: Set focus even if active window is on top and "Prevent focus stealing" option is turned on #24

Open
schrmh opened this issue Apr 11, 2022 · 7 comments · May be fixed by #25

Comments

@schrmh
Copy link

schrmh commented Apr 11, 2022

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.

@GaZaTu
Copy link
Owner

GaZaTu commented Apr 12, 2022

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.

@schrmh
Copy link
Author

schrmh commented Apr 12, 2022

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.

@GaZaTu
Copy link
Owner

GaZaTu commented Apr 12, 2022

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

Screenshot_20220412_235502

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

@GaZaTu GaZaTu linked a pull request Apr 12, 2022 that will close this issue
@GaZaTu
Copy link
Owner

GaZaTu commented Apr 12, 2022

@schrmh what if you try https://github.com/GaZaTu/x11-emoji-picker/actions/runs/2157840101 (the .AppImage whenever it's done) 🤔

@schrmh
Copy link
Author

schrmh commented Apr 12, 2022

@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):
x11-emoji-picker
(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.

@schrmh
Copy link
Author

schrmh commented Feb 18, 2023

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

@schrmh
Copy link
Author

schrmh commented Feb 18, 2023

Okay, actually.... When I try it with my local copy which still is at 7650a30 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).

@schrmh schrmh changed the title Set focus even if active window is on top xfce4/xfwm4: Set focus even if active window is on top and "Prevent focus stealing" option is turned on Feb 18, 2023
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 a pull request may close this issue.

2 participants