summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Finlinson <devin.finlinson@pm.me>2024-01-13 10:02:37 -0700
committerDevin Finlinson <devin.finlinson@pm.me>2024-01-13 10:02:37 -0700
commita3aa87695d3b7fb141489cb3eaa137a2f4f6549b (patch)
treeeb46db089b3d7a8dc7a03f60677d80262a7615a5
parent7b9864af9e84a3809ca8b29e38ec92270559470a (diff)
added config for swayidle
-rw-r--r--home-manager/home.nix1
-rw-r--r--modules/home-manager/swayidle.nix30
-rw-r--r--modules/nixos/hyprland.nix3
3 files changed, 33 insertions, 1 deletions
diff --git a/home-manager/home.nix b/home-manager/home.nix
index d47b6c6..dc6879b 100644
--- a/home-manager/home.nix
+++ b/home-manager/home.nix
@@ -12,6 +12,7 @@
../modules/home-manager/bat.nix
../modules/home-manager/waybar.nix
../modules/home-manager/swaylock.nix
+ ../modules/home-manager/swayidle.nix
];
nixpkgs = {
diff --git a/modules/home-manager/swayidle.nix b/modules/home-manager/swayidle.nix
new file mode 100644
index 0000000..14c6831
--- /dev/null
+++ b/modules/home-manager/swayidle.nix
@@ -0,0 +1,30 @@
+{ pkgs, ... }: {
+ services.swayidle = {
+ enable = true;
+ systemdTarget = "hyprland-session.target";
+ timeouts =
+ let
+ dpmsCommand = "${pkgs.hyprctl}/bin/hyprctl dispatch dpms";
+ brightnessCommand = "${pkgs.brightnessctl}/bin/brightnessctl -s %% brightnessctl s";
+ in
+ [
+ { #timeout 180
+ timeout = 3;
+ command = "${brightnessCommand} 15%";
+ resumeCommand = "brightnessctl -r";
+ }
+ {
+ #timeout 300
+ timeout = 5;
+ command = "${dpmsCommand} off && swaylock --screenshots --clock --indicator-idle-visible --grace 10";
+ resumeCommand = "${dpmsCommand} on";
+ }
+ { #timeout 420
+ timeout = 7;
+ command = "${brightnessCommand} 0%";
+ resumeCommand = "brightnessctl -r";
+ }
+ ];
+ events.before-sleep.event = "swaylock";
+ };
+}
diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix
index 42d061e..4ab6088 100644
--- a/modules/nixos/hyprland.nix
+++ b/modules/nixos/hyprland.nix
@@ -51,7 +51,8 @@
waybar # the status bar
swaybg # the wallpaper
swayidle # the idle timeout
- swaylock # locking the screen
+ swaylock-effects # locking the screen
+ brightnessctl # control device brightness
wlogout # logout menu
wl-clipboard # copying and pasting
hyprpicker # color picker