Files
2026-02-22 19:25:39 +01:00

156 lines
4.0 KiB
Nix
Executable File

{ pkgs, ... } :
{
home.packages = with pkgs; [
hyprlock
hypridle
wlogout
];
home.file = {
lock = {
source = ../assets/lock.png;
target = ".lock.png";
};
};
services = {
# hypridle to
# 150 seconds - turn of monitor
# 300 seconds - lock screen
# 330 seconds - turn of monitor
# 30 minutes - put to sleep
hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
};
listener = [
{
timeout = 150; # 2.5min.
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
{
timeout = 300; # 5min
on-timeout = "loginctl lock-session"; # lock screen when timeout has passed
}
{
timeout = 330; # 5.5min
on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed
on-resume = "hyprctl dispatch dpms on && brightnessctl -r"; # screen on when activity is detected after timeout has fired.
}
{
timeout = 1800; # 30min
on-timeout = "systemctl suspend"; # suspend pc
}
];
};
};
};
programs.wlogout = {
enable = true;
layout = [
{
"label" = "lock";
"action" = "hyprlock";
"text" = "Lock";
"keybind" = "l";
}
{
"label" = "shutdown";
"action" = "systemctl poweroff";
"text" = "Shutdown";
"keybind" = "s";
}
{
"label" = "suspend";
"action" = "systemctl suspend";
"text" = "Suspend";
"keybind" = "u";
}
{
"label" = "reboot";
"action" = "systemctl reboot";
"text" = "Reboot";
"keybind" = "r";
}
{
"label" = "hibernate";
"action" = "systemctl hibernate";
"text" = "Hibernate";
"keybind" = "h";
}
{
"label" = "reboot";
"action" = "systemctl reboot";
"text" = "Reboot";
"keybind" = "r";
}
];
};
catppuccin.wlogout.iconStyle = "wleave";
programs.hyprlock = {
enable = true;
settings = {
auth = {
fingerprint = {
enabled = true;
};
};
background = {
path = "~/.lock.png";
color = "$base";
};
label = {
monitor = "";
text = "$TIME";
color = "$text";
font_size = 90;
position = "0, 0";
halign = "center";
valign = "top";
};
input-field = {
monitor = "";
size = "300, 60";
outline_thickness = 4;
dots_size = 0.2;
dots_spacing = 0.2;
dots_center = true;
outer_color = "$accent";
inner_color = "$surface0";
font_color = "$text";
fade_on_empty = true;
placeholder_text = ''<span foreground="##$textAlpha"><i>󰌾 Logged in as </i><span foreground="##$accentAlpha">$USER</span></span>'';
hide_input = false;
check_color = "$accent";
fail_color = "$red";
fail_text = ''<i>$FAIL <b>($ATTEMPTS)</b></i>'';
capslock_color = "$yellow";
position = "0, -47";
halign = "center";
valign = "center";
};
};
};
catppuccin.hyprlock.enable = true;
catppuccin.hyprlock.flavor = "mocha";
catppuccin.hyprlock.accent = "blue";
catppuccin.hyprlock.useDefaultConfig = false; # we use our own
}