NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.58k stars 13.74k forks source link

nixos/qt: `qt.platformTheme = "gtk2";` breaks `pcmanfm-qt`, `telegram-desktop` and `keepassxc` in pure wayland environment #342115

Open Schweber opened 2 weeks ago

Schweber commented 2 weeks ago

Describe the bug

If i set

  qt = {
    enable = true;
    style = "gtk2";
    platformTheme = "gtk2";
  };

then pcmanfm-qt, telegram-desktop and keepassxc fail with Gtk-WARNING **: 20:09:24.876: cannot open display: in a pure wayland environment. They do work in xwayland though. Other (maybe older/qt5) programs are not affected.

If i delete the settings or set e.g.

  qt = {
    enable = true;
    platformTheme = "qt5ct";
    style = "adwaita-dark";
  };

then the programs work.

Steps To Reproduce

Steps to reproduce the behavior:

  1. see above

Expected behavior

I would like the gtk theme to be adopted by qt in a wayland environment as it is in an X11 environment.

Additional context

https://github.com/lxqt/pcmanfm-qt/issues/1939 https://github.com/NixOS/nixpkgs/issues/333964

Notify maintainers

@NixOS/qt-kde

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.10, NixOS, 24.11 (Vicuna), 24.11.20240913.345c263`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Lix, like Nix) 2.91.0
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/sperber/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/sperber/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/sperber/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/sperber/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/rgpx7kwskibyk067x8bp8a6ihk17fizm-lix-2.91.0/share`
 - nixpkgs: `/nix/store/l3amk5lsakpc93him5kry24kax23sn4h-source`

Add a :+1: reaction to issues you find important.

Schweber commented 1 week ago

@misterio77 I suspect that qt6gtk2 might play a role in that.

Also pinging @thiagokokada @Scrumplex @linsui because you commited to the module recently

Scrumplex commented 1 week ago

Perhaps a symptom of https://github.com/trialuser02/qt6gtk2/issues/2

Schweber commented 1 week ago

Thank you, the thread showed me the solution:

I have to disable the qt module in Nixos and set QT_QPA_PLATFORMTHEME=gtk3. Then everything works as intended. If i understand it correctly, then QT 6 doesn't need compatibility packages to adopt a gtk theme.