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

Gnome Bug: After pressing any system shortcut on keyboard, the overlay window is focused automatically by Gnome. #6

Closed
titoOdUA opened this issue Jun 22, 2023 · 6 comments

Comments

@titoOdUA
Copy link

First of all awesome crate. Thank you.
I have one problem that I can't resolve. I am fairly new to egui and gui development in general, sorry if it is a silly question.

Question: Can I somehow prevent the app from getting focus after using system shortcuts (like changing the keyboard layout)
For example, I am working in the browser, and changing my keyboard (super + space) layout forces focus on my overlay instead of the browser.

Basically, every system shortcut forces focus on the overlay. I guess it is because the overlay is always on top.

But can I somehow prevent it? Maybe to instruct my app to only get focused if some of its elements were clicked?

@coderedart
Copy link
Owner

I just checked on my arch linux (kde, x11) and the focus works like any other normal window even thought i used system shortcuts to change workspace (super + 1/2/3/4) or volume (super + F9/F10) etc...

This might be a platform issue. egui_overlay or the underlying glfw backend never request focus. The only thing that is done implicitly is setting the passthrough property of the window based on whether egui wants it or not.

What OS are you running? For further debugging, you can use the glfw_backend argument in the gui_run fn. the field frame_events contains all the events received in this frame. and you can check if it truly receives the Focus Event .

One random guess would be the hierarchy of the window stack. Because of the always_on_top feature, the system could be transferring the focus on the top window. In that case, you could try disabling the the always on top feature with the glfw_backend.window.set_floating(false). Ofcourse, that would kind of defeat the point of the overlay tho :(

@titoOdUA
Copy link
Author

titoOdUA commented Jun 22, 2023

I am on Pop!_OS 22.04 LTS, gnome 42.5, x11

Thank you for the suggestion.
At least it is good to know that it works on other systems/configurations =)
I will try something out.

UPD:

For further debugging, you can use the glfw_backend argument in the gui_run fn. the field frame_events contains all the events received in this frame. and you can check if it truly receives the Focus Event .

Yeah, it receives a Focus(true) event.

@coderedart
Copy link
Owner

Then it is probably a gnome bug. Does the same thing happen if you set floating to false?

@titoOdUA
Copy link
Author

If I set floating to false overlay window no longer stays always on top.

Installed the Kde, and can confirm that the issue isn't present there. As you have said it is probably a gnome thing.

@coderedart
Copy link
Owner

coderedart commented Jun 22, 2023

nice. if you raise a bug report with gnome, please post the link here so we can track the progress

@coderedart coderedart changed the title Question: Can I somehow prevent the app from getting focus after using system shortcuts (like changing the keyboard layout) Gnome Bug: After pressing any system shortcut on keyboard, the overlay window is focused automatically by Gnome. Jun 25, 2023
@coderedart
Copy link
Owner

It seems some input issues were fixed in the latest gnome 44.3 version. This could be related #11

reopen if the issue is still present in gnome 44.3+

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

No branches or pull requests

2 participants