summary refs log tree commit diff
path: root/nixos/modules/services/x11/desktop-managers/gnome.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-08-29 02:28:38 +0200
committerJan Tojnar <jtojnar@gmail.com>2021-08-29 04:23:34 +0200
commit47afdc46275834f3d6ecb0021dbdda9b77f3729d (patch)
tree850186bf0e2e81e78a77f17eca8c97bc34b1269d /nixos/modules/services/x11/desktop-managers/gnome.nix
parentce77cbef67f6c9d218f99c37bf116389b35ebddd (diff)
downloadnixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.tar
nixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.tar.gz
nixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.tar.bz2
nixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.tar.lz
nixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.tar.xz
nixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.tar.zst
nixpkgs-47afdc46275834f3d6ecb0021dbdda9b77f3729d.zip
nixos/gnome: enable platform integration for Qt
Qt links against GTK to be able to use native GTK file chooser
in GTK-oriented DEs. However, GTK expects a specific environment,
which means the application needs to be wrapped to prevent crashes
when file chooser is opened in some environments.

This patch bypasses the need for wrapping Qt applications with GTK-related
environment since the file chooser dialogue will now come from a separate
process (instantiated by the XDG desktop portal via D-Bus).

In the future, we could remove the GTK dependency from Qt to fix the crashes
on non-{GNOME,Pantheon} environments. Then, users would be able to choose
between non-native Qt dialogue or native one facilitated by XDG portals
(e.g. through setting `QT_QPA_PLATFORMTHEME` to either `qgnomeplatform`,
or `xdgdesktopportal`).

One disadvantage is adding a Qt dependency to GNOME, even for people
who might not use any Qt apps. But they can easily just add `qt5.enable = false;`
to their NixOS configuration.

The configuration is also presumably less battle tested than plain Qt
with its first-party GTK integration. But it is backed by Fedora
and used by Manjaro GNOME so it cannot be that bad.

Lastly, I worry about ABI compatibility of the platform modules
with apps installed from different Nixpkgs revision.
Diffstat (limited to 'nixos/modules/services/x11/desktop-managers/gnome.nix')
-rw-r--r--nixos/modules/services/x11/desktop-managers/gnome.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/gnome.nix b/nixos/modules/services/x11/desktop-managers/gnome.nix
index b0859321a52..4bc42525906 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome.nix
@@ -372,6 +372,13 @@ in
       xdg.portal.enable = true;
       xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
 
+      # Harmonize Qt5 application style and also make them use the portal for file chooser dialog.
+      qt5 = {
+        enable = mkDefault true;
+        platformTheme = mkDefault "gnome";
+        style = mkDefault "adwaita";
+      };
+
       networking.networkmanager.enable = mkDefault true;
 
       services.xserver.updateDbusEnvironment = true;