-
Notifications
You must be signed in to change notification settings - Fork 177
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
Set the desktop filename of the Qt application #774
Conversation
Nice find. I haven't tested, but I wonder if this also fixes #135. |
I have some questions here, because I tried to reproduce this on Fedora 39 (with PySide6, Gnome and Wayland) and Ubuntu 24.04 (with PySide2, Gnome and XWayland), but the window title correctly shows "Dangerzone":
Yeah, we're good. Ubuntu Focal is our oldest supported platform, and even that has Qt 5.12. |
@apyrgio, thank you for testing. Sorry, I think I did not include all the information to make it clear.
Sure, I am using Arch Linux.
Arch Linux does not really have a "stock" window manager, generally you install and use whichever you prefer. I have tested it under Gnome 46 and Sway 1.9 using Wayland 1.22. Also, please note that the issue with the application name I've mentioned is not the window title, but how the application name/icon is displayed in Gnome's window switcher/Activities overview (see #402 for more information).
Both (note that Arch Linux does not have an official package, I am using a modified PKGBUILD to get 0.6.0 instead of 0.5.1 from the AUR). Although I don't think that setting the desktop filename would have an effect on application name/icon when running Dangerzone from source while Dangerzone is not also installed as a package as Gnome would not be able to find the matching .desktop entry. The issue I had initially was not being able to control how Dangerzone window is displayed when it runs under Sway. Sway is a tiling window manager, so by default, the window of an application as it starts is maximized to take up the whole screen (ignoring any window width/height preferences set by the application). I wanted Dangerzone window to be displayed in the size as set in the application, as it does not benefit from starting in full screen mode and looks better when not maximized. To do that under Sway, one can assign certain applications, to start in floating mode and not maximized. To be able to identify an application under Sway/Wayland, the
I've found that setting the desktop filename using While searching for potentially related issues on Dangerzone's issue tracker I've stumbled upon #402. I was able to reproduce it locally under Gnome and have found that setting the desktop entry filename (and thus tha app ID) to
Therefore, I believe that setting the desktop entry filename might also be the fix for #402. Could you test if the Dangerzone application name/icon in Gnome's Activity Overview (pressing the Super key) is correctly displayed on you side and, if not, if setting the desktop filename fixes it? Here are some references to the application name/icon issue from other projects:
Please let me know if I've missed some details or if something is not clear. |
Thanks you very much for the stellar bug report 🤩 . The "looking glass" feature of Gnome was something I didn't know about. I did check on a Fedora 39 VM, and here's what I saw:
With your
And here's where it gets interesting, and probably completely fixes #402. I used
I'm not sure why your In any case, I'd suggest adding the In that case, let's also add a "Fixes #402" in the commit message. |
Sure, although I am wondering if it should be |
I had the same question. The Qt6 docs on
(the respective Qt5 docs have less to say, so there may be some implementation difference) To me, this reads like a case for a literal
In our case this is |
Cool, I'm gonna add this extra setting then, run some tests, and then merge your PR (unless you're already changing stuff). |
Thanks, please go ahead if you'd like to do it more quickly 👍 If not, I'll try to update it later today/tomorrow. |
Currently, the app ID of the Dangerzone GUI application when running under Wayland is `python3`, which is not very useful if one wants to automate some action related to the Dangerzone application window (e.g. to always start Dangerzone window in floating mode under Sway WM). Setting the desktop filename property also sets the app ID of the application under Wayland. According to Qt documentation[1], the property value should be the name of the application's .desktop file but without the extension. Qt documentation also states: > This property gives a precise indication of what desktop entry > represents the application and it is needed by the windowing system to > retrieve such information without resorting to imprecise heuristics. Therefore I also think that setting this property is needed to display the correct application name and icon (taken from the .desktop entry) when running under certain windowing systems (like Wayland) (see also freedomofpress#402). Note that this property is not enough, as we've encountered systems where setting just the desktop file name does not alter the detected application name by the window manager. For this reason, we also use set the application name [2] to `dangerzone`, to remove any ambiguity. [1]: https://doc.qt.io/qt-6/qguiapplication.html#desktopFileName-prop [2]: https://doc.qt.io/qt-6/qcoreapplication.html#applicationName-prop Fixes freedomofpress#402
993f0b5
to
8cdb2d5
Compare
Currently, the app ID of the Dangerzone GUI application when running under Wayland is
python3
, which is not very useful if one wants to automate some action related to the Dangerzone application window (e.g. to always start Dangerzone window in floating mode under Sway WM; to inspect the app ID values of currently running application windows under sway runswaymsg -t get_tree
).Setting the desktop filename property also sets the app ID of the application under Wayland. According to Qt documentation, the property value should be the name of the application's .desktop file but without the extension.
Qt documentation also states:
Therefore I also think that setting this property is needed to display the correct application name and icon (taken from the .desktop entry) when running under certain windowing systems (like Wayland) (see also #402, after testing locally under Gnome I believe this should fix it).
PR questions
According to Qt 5 docs this property was introduced in Qt 5.7. IIUC PySide2 is Qt 5.12+, so it should be ok to set it without wrapping it in
try/except AttributeError
? Please correct me if I am mistaken.Also, I am not sure if perhaps
Application
's__init__
is the more suitable/correct place for setting it. Please let me know if it should be moved there.