signal-desktop: support wayland

This commit is contained in:
2023-12-03 12:18:55 +00:00
parent 0ba012fd7c
commit a131358c36
2 changed files with 34 additions and 9 deletions

View File

@@ -106,7 +106,7 @@
, libpulseaudio , libpulseaudio
, libwebp , libwebp
, libxslt , libxslt
, makeWrapper , makeShellWrapper
, mesa , mesa
, nodejs # version 18 , nodejs # version 18
# , nodejs_latest # , nodejs_latest
@@ -187,16 +187,21 @@ stdenv.mkDerivation rec {
hash = "sha256-gtbsb78VFZvESOGu6duB8vKsrtWM7UxGf9che0ijK/M="; hash = "sha256-gtbsb78VFZvESOGu6duB8vKsrtWM7UxGf9che0ijK/M=";
}; };
# patches = [ patches = [
# ./debug.patch # ./debug.patch
# ]; # fix bug that signal launches in the background on wayland
# - <https://github.com/signalapp/Signal-Desktop/issues/6368>
# - without this, signal can be started with `signal-desktop & ; sleep 5; signal-desktop`
# - the second instance wakes the first one, and then exits
./show-on-launch.patch
];
nativeBuildInputs = [ nativeBuildInputs = [
autoPatchelfHook autoPatchelfHook
fixup_yarn_lock fixup_yarn_lock
git # to calculate build date git # to calculate build date
gnused gnused
makeWrapper makeShellWrapper
nodejs' # possibly i could instead use nodejs-slim (npm-less nodejs) nodejs' # possibly i could instead use nodejs-slim (npm-less nodejs)
python3 python3
wrapGAppsHook wrapGAppsHook
@@ -233,6 +238,8 @@ stdenv.mkDerivation rec {
# env.NODE_ENV = "production"; # env.NODE_ENV = "production";
# env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; # env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
dontWrapGApps = true;
postPatch = '' postPatch = ''
# fixes build failure: # fixes build failure:
# > Fusing electron at /build/source/release/linux-unpacked/signal-desktop inspect-arguments=false # > Fusing electron at /build/source/release/linux-unpacked/signal-desktop inspect-arguments=false
@@ -352,14 +359,18 @@ stdenv.mkDerivation rec {
# cp -R release/linux-unpacked/locales $out/lib/Signal/locales # cp -R release/linux-unpacked/locales $out/lib/Signal/locales
mkdir $out/bin mkdir $out/bin
makeWrapper ${electron'}/bin/electron $out/bin/signal-desktop \
--add-flags $out/lib/Signal/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0
runHook postInstall runHook postInstall
''; '';
preFixup = ''
makeShellWrapper ${electron'}/bin/electron $out/bin/signal-desktop \
"''${gappsWrapperArgs[@]}" \
--add-flags $out/lib/Signal/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0
'';
passthru = { passthru = {
# inherit bettersqlitePatch signal-fts5-extension; # inherit bettersqlitePatch signal-fts5-extension;
updateScript = gitUpdater { updateScript = gitUpdater {

View File

@@ -0,0 +1,14 @@
diff --git a/app/main.ts b/app/main.ts
index 8388480e6..baedcfb55 100644
--- a/app/main.ts
+++ b/app/main.ts
@@ -749,7 +749,7 @@ async function createWindow() {
const titleBarOverlay = await getTitleBarOverlay();
const windowOptions: Electron.BrowserWindowConstructorOptions = {
- show: false,
+ show: true,
width: DEFAULT_WIDTH,
height: DEFAULT_HEIGHT,
minWidth: MIN_WIDTH,