signal-desktop: support wayland

This commit is contained in:
Colin 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
, libwebp
, libxslt
, makeWrapper
, makeShellWrapper
, mesa
, nodejs # version 18
# , nodejs_latest
@ -187,16 +187,21 @@ stdenv.mkDerivation rec {
hash = "sha256-gtbsb78VFZvESOGu6duB8vKsrtWM7UxGf9che0ijK/M=";
};
# patches = [
# ./debug.patch
# ];
patches = [
# ./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 = [
autoPatchelfHook
fixup_yarn_lock
git # to calculate build date
gnused
makeWrapper
makeShellWrapper
nodejs' # possibly i could instead use nodejs-slim (npm-less nodejs)
python3
wrapGAppsHook
@ -233,6 +238,8 @@ stdenv.mkDerivation rec {
# env.NODE_ENV = "production";
# env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
dontWrapGApps = true;
postPatch = ''
# fixes build failure:
# > 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
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
'';
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 = {
# inherit bettersqlitePatch signal-fts5-extension;
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,