From 6174f3650cf42aaf008012e828d5a1f8e2ce037f Mon Sep 17 00:00:00 2001 From: Leander Scherer Date: Thu, 8 Jan 2026 02:48:11 +0100 Subject: refactor(modules): separate nixos/home-manager modules, use standard option conventions --- modules/hosts/desktop/sway/swayidle.nix | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 modules/hosts/desktop/sway/swayidle.nix (limited to 'modules/hosts/desktop/sway/swayidle.nix') diff --git a/modules/hosts/desktop/sway/swayidle.nix b/modules/hosts/desktop/sway/swayidle.nix new file mode 100644 index 0000000..df8dbdc --- /dev/null +++ b/modules/hosts/desktop/sway/swayidle.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + username, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.swayidle; +in +{ + options.nx.desktop.swayidle.enable = mkEnableOption "Enable swayidle configuration" // { + default = config.nx.desktop.sway.enable; + }; + config = mkIf cfg.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