Skip to content

Commit

Permalink
Set the desktop filename of the Qt application
Browse files Browse the repository at this point in the history
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).

[1]: https://doc.qt.io/qt-6/qguiapplication.html#desktopFileName-prop
  • Loading branch information
naglis committed Apr 9, 2024
1 parent 7c4e629 commit 993f0b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dangerzone/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ def gui_main(dummy_conversion: bool, filenames: Optional[List[str]]) -> bool:
# Create the Qt app
app = Application()

# 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.
app.setDesktopFileName("press.freedom.dangerzone")

# Common objects
if getattr(sys, "dangerzone_dev", False) and dummy_conversion:
dummy = Dummy()
Expand Down

0 comments on commit 993f0b5

Please sign in to comment.