Commit cea6d77f authored by Berk D. Demir's avatar Berk D. Demir
Browse files

_1password-gui{,-beta}: Re-enable Wayland support

- Gate Electron's Ozone platform hint behind NIXOS_OZONE_WL env var.
- No need to gate on WAYLAND_DISPLAY because Electron will first check
  XDG_SESSION_TYPE==wayland [^1], if it fails, then it will check for
  WAYLAND_DISPLAY[^2], even setting it to `wayland-0` if it finds a
  `wayland-0` socket under $XDG_SESSION_DIR.
- No need to restore `--enable-features=WaylandWindowDecorations` switch
  as it's been enabled by default since Aug 2023.
  https://github.com/electron/electron/pull/39644/files
- No point in passing --enable-wayland-ime=true, which requires GTK4
  but 1Password ships linking only against GTK3.

[^1] linux/display_server_utils.cc:MaybeFixPlatformName - https://source.chromium.org/chromium/chromium/src/+/main:ui/linux/display_server_utils.cc;l=72-74;drc=3a35ef8d20836722c95b230f7248c73faea599e7;bpv=0;bpt=1
[^2] linux/display_server_utils.cc:InspectWaylandDisplay - https://source.chromium.org/chromium/chromium/src/+/main:ui/linux/display_server_utils.cc;l=34-51;drc=3a35ef8d20836722c95b230f7248c73faea599e7;bpv=1;bpt=1
parent 186819cc
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -146,12 +146,8 @@ stdenv.mkDerivation {
    makeShellWrapper $out/share/1password/1password $out/bin/1password \
      "''${gappsWrapperArgs[@]}" \
      --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]}
      # Currently half broken on wayland (e.g. no copy functionality)
      # See: https://github.com/NixOS/nixpkgs/pull/232718#issuecomment-1582123406
      # Remove this comment when upstream fixes:
      # https://1password.community/discussion/comment/624011/#Comment_624011
      #--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]} \
      --add-flags "\''${NIXOS_OZONE_WL:+--ozone-platform-hint=auto}"
  '';

  passthru.updateScript = ./update.sh;