From 03f03eee9f8417b540f0d1b0d1e8a4626d455ac3 Mon Sep 17 00:00:00 2001 From: schererleander Date: Mon, 3 Nov 2025 00:19:09 +0100 Subject: chore: reorganize modules into subcategories --- modules/desktop/sway/swayidle.nix | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/desktop/sway/swayidle.nix (limited to 'modules/desktop/sway/swayidle.nix') diff --git a/modules/desktop/sway/swayidle.nix b/modules/desktop/sway/swayidle.nix new file mode 100644 index 0000000..0708abc --- /dev/null +++ b/modules/desktop/sway/swayidle.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + username, + ... +}: + +{ + options.nx.desktop.swayidle.enable = lib.mkEnableOption "Enable swayidle configuration" // { + default = config.nx.desktop.sway.enable; + }; + config = lib.mkIf config.nx.desktop.swayidle.enable { + home-manager.users."${username}" = { + services.swayidle = { + enable = true; + timeouts = [ + { + timeout = 300; + command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; + } + { + timeout = 600; + command = "${pkgs.sway}/bin/swaymsg 'output * dpms off"; + resumeCommand = "${pkgs.sway}/bin/swaymsg output * dpms on"; + } + { + timeout = 900; + command = "${pkgs.systemd}/bin/systemctl suspend"; + } + ]; + events = [ + { + event = "after-resume"; + command = "${pkgs.sway}/bin/swaymsg output * dpms on"; + } + { + event = "before-sleep"; + command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; + } + ]; + }; + }; + }; +} -- cgit v1.3.1