diff --git a/user/sway/default.nix b/user/sway/default.nix index 5a3863f..70d95ec 100644 --- a/user/sway/default.nix +++ b/user/sway/default.nix @@ -19,9 +19,11 @@ let ''; in { - imports = [ ./theme.nix ./mako.nix ./swaylock.nix ]; + imports = [ ./theme.nix ./mako.nix ./swaylock.nix ./swayidle.nix ]; config = { programs.mako.enable = true; + services.swayidle.enable = true; + wayland.windowManager.sway = let mod = "Mod4"; @@ -357,31 +359,6 @@ in exec swaymsg workspace 2 ''; }; - services.swayidle = { - enable = true; - timeouts = [ - { - timeout = 360; - command = "${pkgs.swaylock}/bin/swaylock -f"; - } - { - timeout = 1800; - command = '' - mpc status | grep "^[playing]" > /dev/null || ${pkgs.sway}/bin/swaymsg "output * dpms off"''; - resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * dpms on"''; - } - ]; - events = [ - { - event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock -f"; - } - { - event = "after-resume"; - command = ''swaymsg "output * dpms on"''; - } - ]; - }; services.gammastep = { enable = true; provider = "geoclue2"; diff --git a/user/sway/swayidle.nix b/user/sway/swayidle.nix new file mode 100644 index 0000000..697a1cc --- /dev/null +++ b/user/sway/swayidle.nix @@ -0,0 +1,34 @@ +{ config, pkgs, lib, ... }: +let + inherit (pkgs.uservars) key accent font theme; + inherit (theme) color; +in +{ + services.swayidle = { + timeouts = [ + { + timeout = 360; + command = "${pkgs.swaylock}/bin/swaylock -f"; + } + { + timeout = 1800; + command = '' + mpc status | grep "^[playing]" > /dev/null || ${pkgs.sway}/bin/swaymsg "output * dpms off" + ''; + resumeCommand = '' + ${pkgs.sway}/bin/swaymsg "output * dpms on" + ''; + } + ]; + events = [ + { + event = "before-sleep"; + command = "${pkgs.swaylock}/bin/swaylock -f"; + } + { + event = "after-resume"; + command = ''swaymsg "output * dpms on"''; + } + ]; + }; +}