From c687d059c5dd17ddf6532367b61148c84b7408af Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 3 Dec 2023 12:59:15 +0000 Subject: [PATCH] signal-desktop: support wayland even when running as a service --- hosts/common/programs/signal-desktop.nix | 2 ++ pkgs/additional/signal-desktop-from-src/default.nix | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/hosts/common/programs/signal-desktop.nix b/hosts/common/programs/signal-desktop.nix index ebfdf4259..feac41c55 100644 --- a/hosts/common/programs/signal-desktop.nix +++ b/hosts/common/programs/signal-desktop.nix @@ -30,6 +30,8 @@ in Restart = "always"; RestartSec = "20s"; }; + # for some reason the --ozone-platform-hint=auto flag fails when signal-desktop is launched from a service + environment.NIXOS_OZONE_WL = "1"; }; }; } diff --git a/pkgs/additional/signal-desktop-from-src/default.nix b/pkgs/additional/signal-desktop-from-src/default.nix index 67871d8f0..9cfc4b709 100644 --- a/pkgs/additional/signal-desktop-from-src/default.nix +++ b/pkgs/additional/signal-desktop-from-src/default.nix @@ -120,6 +120,7 @@ , stdenv # , substituteAll , wrapGAppsHook +, xdg-utils , yarn }: let @@ -364,9 +365,15 @@ stdenv.mkDerivation rec { ''; preFixup = '' + # XXX: add --ozone-platform-hint=auto to make it so that NIXOS_OZONE_WL isn't *needed*. + # electron should auto-detect x11 v.s. wayland: launching with `NIXOS_OZONE_WL=1` is an optional way to force it when debugging. + # xdg-utils: needed for ozone-platform-hint=auto to work + # else `LaunchProcess: failed to execvp: xdg-settings` makeShellWrapper ${electron'}/bin/electron $out/bin/signal-desktop \ "''${gappsWrapperArgs[@]}" \ --add-flags $out/lib/Signal/resources/app.asar \ + --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \ + --add-flags --ozone-platform-hint=auto \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}" \ --inherit-argv0 '';