git.iko.soy/typeable/nixpkgs
on master help sign in
wrapFirefox: support GDK_BACKEND=wayland

The firefox wrapper now supports setting the GDK_BACKEND to wayland which is useful in cases where firefox would be started from within an X-Application inside of wayland. GTK/GDK would otherwise default to the X11 backend in those situations. The intention is that people that are using wayland primarily pull in the new `firefox-wayland` top-level attribute into their environments instead of just `firefox`. Firefox will then always be started with the correct rendering backend.

commit7eaef48e5a2eaf9be0d6ce961fdb45e81b150dac authorAndreas Rammhold <andreas@rammhold.de> dateSun 3 Feb 2019, 12:06 (8 years ago) parentd7731c3
2 files changed+8−2
pkgs/applications/networking/browsers/firefox/wrapper.nix+7−2 pkgs/top-level/all-packages.nix+1
pkgs/applications/networking/browsers/firefox/wrapper.nix+7−2
@@ -26,8 +26,11 @@ let
2626 , icon ? browserName
2727 , extraPlugins ? []
2828 , extraNativeMessagingHosts ? []
29+ , gdkWayland ? false
2930 }:
3031
32+ assert gdkWayland -> (browser ? gtk3); # Can only use the wayland backend if gtk3 is being used
33+
3134 let
3235 cfg = config.${browserName} or {};
3336 enableAdobeFlash = cfg.enableAdobeFlash or false;
@@ -86,7 +89,7 @@ let
8689 exec = "${browserName}${nameSuffix} %U";
8790 inherit icon;
8891 comment = "";
89− desktopName = "${desktopName}${nameSuffix}";
92+ desktopName = "${desktopName}${nameSuffix}${lib.optionalString gdkWayland " (Wayland)"}";
9093 genericName = "Web Browser";
9194 categories = "Application;Network;WebBrowser;";
9295 mimeType = stdenv.lib.concatStringsSep ";" [
@@ -124,7 +127,9 @@ let
124127 --suffix PATH ':' "$out${browser.execdir or "/bin"}" \
125128 --set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \
126129 --set MOZ_SYSTEM_DIR "$out/lib/mozilla" \
127− ${lib.optionalString (browser ? gtk3)
130+ ${lib.optionalString gdkWayland ''
131+ --set GDK_BACKEND "wayland" \
132+ ''}${lib.optionalString (browser ? gtk3)
128133 ''--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
129134 --suffix XDG_DATA_DIRS : '${gnome3.defaultIconTheme}/share'
130135 ''
pkgs/top-level/all-packages.nix+1
@@ -17164,6 +17164,7 @@ with pkgs;
1716417164 icecat-unwrapped = firefoxPackages.icecat;
1716517165
1716617166 firefox = wrapFirefox firefox-unwrapped { };
17167+ firefox-wayland = wrapFirefox firefox-unwrapped { gdkWayland = true; };
1716717168 firefox-esr-52 = wrapFirefox firefox-esr-52-unwrapped { };
1716817169 firefox-esr-60 = wrapFirefox firefox-esr-60-unwrapped { };
1716917170 firefox-esr = firefox-esr-60;