configure hypridle and remove swayidle

This commit is contained in:
Adithya 2024-05-12 21:42:10 +05:30
parent be6bf03132
commit 3cdba5762a
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
3 changed files with 40 additions and 32 deletions

View file

@ -1,8 +1,44 @@
{pkgs, ...}: {
{ config, pkgs, ... }:
let
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
lock-session = "${pkgs.systemd}/bin/loginctl lock-session";
in
{
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "${pkgs.hyprlock}/bin/hyprlock";
unlock_cmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
before_sleep_cmd = lock-session;
after_sleep_cmd = "${hyprctl} dispatch dpms on";
};
listener = [
{
timeout = 240;
on-timeout = "${brightnessctl} -s set 30";
on-resume = "${brightnessctl} -r";
}
{
timeout = 240;
on-timeout = "${brightnessctl} -sd dell::kbd_backlight set 0";
on-resume = "${brightnessctl} -rd dell::kbd_backlight";
}
{
timeout = 600;
on-timeout = lock-session;
}
{
timeout = 660;
on-timeout = "${hyprctl} dispatch dpms off";
on-resume = "${hyprctl} dispatch dpms on";
}
{
timeout = 900;
on-timeout = "${pkgs.systemd}/bin/systemctl suspend";
}
];
};
};
}

View file

@ -1,28 +0,0 @@
{ config, ... }:
let
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
swaylock = "${config.programs.swaylock.package}/bin/swaylock";
in
{
services.swayidle = {
enable = true;
systemdTarget = "graphical-session.target";
events = [
{
event = "before-sleep";
command = "${swaylock} -f -i /tmp/wallpaper.jpg";
}
];
timeouts = [
{
timeout = 600;
command = "${swaylock} -f -i /tmp/wallpaper.jpg";
}
{
timeout = 900;
command = "${hyprctl} dispatch dpms off";
resumeCommand = "${hyprctl} dispatch dpms on";
}
];
};
}

View file

@ -10,7 +10,7 @@ let
kitty = "${config.programs.kitty.package}/bin/kitty";
playerctl = "${pkgs.playerctl}/bin/playerctl";
rofi = "${config.programs.rofi.package}/bin/rofi";
hyprlock = "${config.programs.hyprlock.package}/bin/hyprlock";
loginctl = "${pkgs.systemd}/bin/loginctl";
tmux = "${config.programs.tmux.package}/bin/tmux";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
@ -165,7 +165,7 @@ in
"SUPER_SHIFT,y, exec, ${pkgs.scripts}/bin/youtube"
"SUPER_SHIFT,b, exec, ${pkgs.rofi-bluetooth}/bin/rofi-bluetooth"
"SUPER,escape, exec, ${hyprlock}"
"SUPER,escape, exec, ${loginctl} lock-session"
"SUPER_SHIFT,W, exec, systemctl --user start wallpaper.service"
"SUPER,1, workspace, 1"