Commit 19b7cbb76fd4

Vincent Demeester <vincent@sbr.pm>
2026-02-24 17:03:44
fix(swayidle): only power off laptop screen on niri
External monitors via Thunderbolt docks (LG Ultrawide) got their firmware stuck in deep power save when sent DPMS off, requiring a physical power cycle to recover. Now only eDP-1 is powered off; the lock screen wallpaper blanks externals.
1 parent 8ed455d
Changed files (1)
home
common
desktop
home/common/desktop/sway/swayidle.nix
@@ -6,12 +6,23 @@
 let
   powerOffCmd =
     if desktop == "niri" then
-      "${pkgs.niri}/bin/niri msg action power-off-monitors"
+      "${niriPowerOffScript}"
     else
       ''${pkgs.sway}/bin/swaymsg "output * power off"'';
+  # For niri: only power off the laptop screen (eDP-1). External monitors
+  # connected via Thunderbolt docks (e.g. LG Ultrawide) can get their firmware
+  # stuck in deep power save when sent DPMS off — DDC communication dies and
+  # the monitor won't wake up without a physical power cycle.
+  # The lock screen wallpaper effectively blanks external monitors instead.
+  niriPowerOffScript = pkgs.writeShellScript "niri-power-off-monitors" ''
+    ${pkgs.niri}/bin/niri msg output eDP-1 off
+  '';
+  niriPowerOnScript = pkgs.writeShellScript "niri-power-on-monitors" ''
+    ${pkgs.niri}/bin/niri msg output eDP-1 on
+  '';
   powerOnCmd =
     if desktop == "niri" then
-      "${pkgs.niri}/bin/niri msg action power-on-monitors"
+      "${niriPowerOnScript}"
     else
       ''${pkgs.sway}/bin/swaymsg "output * power on"'';
 in