mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Set the desktop filename and app name of the Qt application
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 #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 #402
This commit is contained in:
parent
307ecd495c
commit
8cdb2d5720
1 changed files with 15 additions and 0 deletions
|
@ -56,6 +56,21 @@ class Application(QtWidgets.QApplication):
|
|||
with open(get_resource_path("dangerzone.css"), "r") as f:
|
||||
style = f.read()
|
||||
self.setStyleSheet(style)
|
||||
|
||||
# Needed under certain windowing systems to match the application to the
|
||||
# desktop entry in order to display the correct application name and icon
|
||||
# and to allow identifying windows that belong to the application (e.g.
|
||||
# under Wayland it sets the correct app ID). The value is the name of the
|
||||
# Dangerzone .desktop file.
|
||||
self.setDesktopFileName("press.freedom.dangerzone")
|
||||
|
||||
# In some combinations of window managers and OSes, if we don't set an
|
||||
# application name, then the window manager may report it as `python3` or
|
||||
# `__init__.py`. Always set this to `dangerzone`, which corresponds to the
|
||||
# executable name as well.
|
||||
# See: https://github.com/freedomofpress/dangerzone/issues/402
|
||||
self.setApplicationName("dangerzone")
|
||||
|
||||
self.original_event = self.event
|
||||
|
||||
def monkeypatch_event(arg__1: QtCore.QEvent) -> bool:
|
||||
|
|
Loading…
Reference in a new issue