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

[GUI] Tray icon doesn't bring the window up if minimized or hidden behind another window #3667

Closed
ricab opened this issue Sep 11, 2024 · 7 comments · Fixed by #3671
Closed
Assignees
Labels

Comments

@ricab
Copy link
Collaborator

ricab commented Sep 11, 2024

Describe the bug

When the GUI is running but the windows is hidden behind other windows, or minimized, clicking the tray icon does not bring it up front.

Additional info

  • OS: Linux
  • multipass version: 1.14
@ricab ricab added bug needs triage Issue needs to be triaged and removed needs triage Issue needs to be triaged labels Sep 11, 2024
@andrei-toterman
Copy link
Contributor

andrei-toterman commented Sep 11, 2024

For some more context, it seems GTK cannot reliably guarantee that a window is brought to front and is given focus: https://discourse.gnome.org/t/how-to-raise-a-window-in-gtk3-i-e-unminimize-it-bring-it-on-top-of-other-windows-and-focus-it/17100

The window_manager plugin is using gtk_window_present in its focus implementation, so that might explain why it does not give the window focus even if we call windowManager.focus()

@ricab
Copy link
Collaborator Author

ricab commented Sep 11, 2024

Interesting. Are we calling windowManager.focus() yet?

I just tried with another application that has a tray icon. It indeed does not bring the window up, but I get a notification, when I try to bring up the window from the tray, saying " is ready". Clicking on the notification then brings the window up for me. I think that is the most we could aim for in Gnome.

@andrei-toterman
Copy link
Contributor

andrei-toterman commented Sep 11, 2024

Are we calling windowManager.focus() yet?

No, but I tried it and it still didn't work...

@levkropp
Copy link
Contributor

I can also confirm that adding windowManager.focus() doesn't change anything

After tracing through the discussion on the GNOME discourse and the associated github issues, it seems we could try building our own version of the window_manager flutter plugin with the focus() function patched in a way similar to Betterbird/thunderbird-patches#206 (replace gtk_window_present with gtk_window_present_with_time) and investigate if that has any effect.

Otherwise it seems that there are no other potential solutions to this behavior with the current build of window_manager using gtk_window_present

@ricab
Copy link
Collaborator Author

ricab commented Sep 11, 2024

I see, thanks for clarifying @levkropp. Do you want to give that forked window_manager approach a shot?

@levkropp
Copy link
Contributor

I think I am having success with calling windowManager.restore() before windowManager.show(), restore() calls gtk_window_deiconify as well as gtk_window_present https://docs.gtk.org/gtk3/method.Window.deiconify.html

In my testing, this has made it so "Open in Multipass" for an instance either opens the Multipass window (if keyboard focus is not stolen) or shows the " is ready" dialog if typing focus is on another app 100% of the time. Please let me know if adding windowManager.restore() before windowManager.show() helps for you as well @ricab @andrei-toterman

@andrei-toterman
Copy link
Contributor

@levkropp I can confirm that restore behaves much better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants