From 441a7f81047ae612adf978a86c0d7d1e66af5454 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 23 Feb 2024 11:32:03 +0100 Subject: [PATCH] sway: Power on individual displays so order maybe is preserved --- home-manager/modules/sway/default.nix | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/home-manager/modules/sway/default.nix b/home-manager/modules/sway/default.nix index 9d49225..e685e99 100644 --- a/home-manager/modules/sway/default.nix +++ b/home-manager/modules/sway/default.nix @@ -332,17 +332,23 @@ in } ]; - timeouts = [ - { - timeout = 900; - command = swaylockcmd; - } - { - timeout = 1200; - command = "${pkgs.sway}/bin/swaymsg 'output * power off'"; - resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * power on'"; - } - ]; + timeouts = + let + resumeMessages = builtins.concatStringsSep ", " ( + builtins.map (name: "output ${name} power on") (builtins.attrNames cfg.output) + ); + in + [ + { + timeout = 900; + command = swaylockcmd; + } + { + timeout = 1200; + command = "${pkgs.sway}/bin/swaymsg 'output * power off'"; + resumeCommand = "${pkgs.sway}/bin/swaymsg '${resumeMessages}'"; + } + ]; }; };