signal-desktop: support wayland even when running as a service

This commit is contained in:
2023-12-03 12:59:15 +00:00
parent a131358c36
commit c687d059c5
2 changed files with 9 additions and 0 deletions

View File

@@ -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";
};
};
}

View File

@@ -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
'';