Skip to content

[Bug]: Wayland missing menu, application icon and title #415

Closed
@zierf

Description

@zierf

Checklist

  • I am using an up-to-date version.
  • I have read the documentation.
  • I have searched existing issues.

TagStudio Version

main #cb4798b AND Alpha v9.4

Operating System & Version

NixOS 24.11 (Vicuna), 24.11.20240818.8a33541 | nixpkgs-unstable#8a33541 | KDE

Description

TagStudio does not display the global menu, appropriate icon or title under Wayland.

The entire menu is also missing if the desktop environment uses global menus (also called appmenu or dbus-menu). The menu is then neither displayed in the window itself nor in the global menu.

This means that the application is not usable at all.

Apart from NixOS, I also verified this on a Debian virtual machine with the pre-built Alpha v9.3.2 release, and it behaves the same there.

Screenshot_20240829_200922


Apparently Wayland needs a suitable .desktop file to display the correct title and icon. Just like someone referenced here with app.setDesktopFileName("myapp") to set a system icon.

See also this C++ example. You could possibly use something similar in the tagstudio/src/qt/ts_qt.py file.

if sys.platform != "darwin":
    icon = QIcon()
    icon.addFile(str(icon_path))
    app.setWindowIcon(icon)

if sys.platform == "linux":
    # app icon must be defined in a .desktop file to be displayed under Wayland
    app.setDesktopFileName("TagStudio");

Just for fun, I tried to use the icon for KDE-Discover, which has a .desktop file on the system. This actually made the icon and title match.

if sys.platform == "linux":
    # app icon must be defined in a .desktop file to be displayed under Wayland
    app.setDesktopFileName("org.kde.discover");

Screenshot_20240829_201108


The global menu should have been supported by QT6 applications by now, and this is also the case with normal KDE applications. Here is an old KDE Bug #448078 (and his sibling KDE Bug #455155) about it that has been marked as resolved.

Interestingly, if you start the application with XWayland instead of directly in Wayland, the icon and global menu suddenly work. This can be overridden with the environment variable QT_QPA_PLATFORM.

So if you start the application with QT_QPA_PLATFORM=xcb tagstudio or alternatively by setting the variable in flake.nix beforehand, the correct icon and the global menu appear. The title is apparently not set correctly, in this case it just says Desktop instead on my system.

Screenshot_20240829_201251

It would therefore make sense to initially move XWayland before Wayland in the flake.nix environment variable, which should then provide a menu for most users.

QT_QPA_PLATFORM = "xcb;wayland";

Alternatively, you would have to explicitly disable the global menu by deactivating the native menu bar in Python. This means that the menu is always displayed directly in the window itself, but is then no longer integrated into the system as desired.

menu_bar.setNativeMenuBar(False)

I hope that someone can find a solution for the missing menu under Wayland that does not require XWayland to be preferred or the native/global menu to be deactivated. Unfortunately, I have no idea whether it is due to a bug in the PySide6 library itself or whether NixOS cannot recognize it correctly due to an extra Python layer in front of the QT6 framework. It wants to register a menu in DBUS, but it's just not visible.

Expected Behavior

Correct title, icon and at least a usable menu, while a global menu is preferred.

Steps to Reproduce

  1. Open TagStudio

Logs

Branch Alpha-v9.4
$> ./TagStudio.sh

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
[ResourceManager] 4 resources registered
[QT DRIVER] Config File not specified, defaulting to /home/USERNAME/.config/TagStudio/TagStudio.ini
qt.qpa.wayland: EGL not available
Calling NavForward with Content:False, Index:0, PageCount:0
[ENTRY PANEL] UPDATE WIDGETS ([])
[LIBRARY] Extension list loaded in 0.000 seconds
[LIBRARY] Tags loaded in 0.000 seconds
[LIBRARY] Entries loaded in 0.001 seconds
[LIBRARY] Collations loaded in 0.000 seconds
[ENTRY PANEL] UPDATE WIDGETS ([])
Query:, Frame: 0,  Length: 140
Calling NavForward with Content:(<ItemType.ENTRY: 0>, 139), Index:0, PageCount:1
[UPDATE CONTAINER] Setting tags updated slot
[ENTRY PANEL] UPDATE WIDGETS ([(<ItemType.ENTRY: 0>, 5)])
Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
QRhi* initializeRHI(QRhi*) : No RHI backend. Using CPU conversion.
Saving Library...
[LIBRARY] Saving Library to Disk...
[LIBRARY] Formatting Tags to JSON...
[LIBRARY] Formatting Entries to JSON...
[LIBRARY] Formatting Collations to JSON...
[LIBRARY] Done Formatting to JSON!
[LIBRARY] Library saved to disk in 0.002 seconds
[SHUTDOWN] Ending Thumbnail Threads...
Branch main (Commit #cb4798b)
$> tagstudio

[ResourceManager] 4 resources registered
[QT DRIVER] Config File not specified, defaulting to /home/USERNAME/.config/TagStudio/TagStudio.ini
No QtMultimedia backends found. Only QMediaDevices, QAudioDevice, QSoundEffect, QAudioSink, and QAudioSource are available.
Failed to initialize QMediaPlayer "Not available"
Failed to create QVideoSink "Not available"
Calling NavForward with Content:False, Index:0, PageCount:0
[ENTRY PANEL] UPDATE WIDGETS ([])
[LIBRARY] Extension list loaded in 0.000 seconds
[LIBRARY] Tags loaded in 0.000 seconds
[LIBRARY] Entries loaded in 0.001 seconds
[LIBRARY] Collations loaded in 0.000 seconds
[ENTRY PANEL] UPDATE WIDGETS ([])
Query:, Frame: 0,  Length: 140
Calling NavForward with Content:(<ItemType.ENTRY: 0>, 139), Index:0, PageCount:1
Saving Library...
[LIBRARY] Saving Library to Disk...
[LIBRARY] Formatting Tags to JSON...
[LIBRARY] Formatting Entries to JSON...
[LIBRARY] Formatting Collations to JSON...
[LIBRARY] Done Formatting to JSON!
[LIBRARY] Library saved to disk in 0.002 seconds
[SHUTDOWN] Ending Thumbnail Threads...

Metadata

Metadata

Assignees

Labels

Priority: LowDoesn't require immediate attentionSystem: LinuxFor Linux/BSD distributionsType: BugSomething isn't working as intendedType: InstallationInstalling, building, and/or launching the program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions