From a3aa87695d3b7fb141489cb3eaa137a2f4f6549b Mon Sep 17 00:00:00 2001 From: Devin Finlinson Date: Sat, 13 Jan 2024 10:02:37 -0700 Subject: added config for swayidle --- home-manager/home.nix | 1 + modules/home-manager/swayidle.nix | 30 ++++++++++++++++++++++++++++++ modules/nixos/hyprland.nix | 3 ++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 modules/home-manager/swayidle.nix 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 -- cgit v1.2.3