Use isFocused() instead of isVisible() in tray service to refocus Signal window - #7048
Use isFocused() instead of isVisible() in tray service to refocus Signal window#7048major-mayer wants to merge 2 commits into
Conversation
|
I tested this on KDE Plasma (X11 and Wayland) and on Windows. Can't test on MacOS, but from my understand should work as expected. Couldn't test gnome yet. Since the gnome tray has no click handler, but instead opens directly the context menu, might be worth trying to check if focus is still on the application, when clicking the tray icon. Also I think there is a test for the modified service, which mocks the Last thing. This changes the behavior a little bit, so the text displayed in the context menu might need new translations. |
…ts for correct labels
|
@Sajito Thanks again for your valuable input. Furthermore, I noticed that even with my changes, the context menu label was often incorrect, for example, when you open Signal Desktop, and then focus a different window. This is because the correct label was only re-evaluated using the This fixes the problem for me. |
First time contributor checklist:
Contributor checklist:
mainbranchnpm run readyrun passes successfully (more about tests here)Description
This PR should close #6429.
As suggested by @Sajito, it changes the
SystemTrayServicein a way that instead of using theisVisiblemethod it now makes use of theisFocusedmethod in the click handler/ menu builder to determine, whether the Signal Desktop app should be hidden or shown.While in theory
isVisibleshould also lead to the desired behavior, on platforms like KDE Plasma this doesn't work and reports true even if the window is out of focus.With the
isFocusedmethod, this is not the case anymore.I only tested this PR on Manjaro Linux running KDE Plasma 6 (Wayland), so it would be helpful to test the new behavior on other platforms as well.
I can maybe do the Windows 11 test as well.