67 lines
1.8 KiB
Nix
67 lines
1.8 KiB
Nix
{ pkgs, ... }:
|
|
with pkgs.lib.nix-rice;
|
|
let
|
|
strPalette = palette.toRgbShortHex pkgs.rice.colorPalette;
|
|
in
|
|
{
|
|
services.swayidle = {
|
|
enable = true;
|
|
systemdTarget = "graphical-session.target";
|
|
extraArgs = [ "-w" ];
|
|
events = [
|
|
{
|
|
event = "lock";
|
|
command = "${pkgs.swaylock-plugin}/bin/swaylock-plugin";
|
|
}
|
|
{
|
|
event = "after-resume";
|
|
command = "/home/emenel/.local/bin/on-unlock";
|
|
}
|
|
];
|
|
|
|
timeouts = [
|
|
{
|
|
timeout = 60;
|
|
command = "/home/emenel/.local/bin/dim-all-monitors";
|
|
resumeCommand = "/home/emenel/.local/bin/on-unlock";
|
|
}
|
|
|
|
# battery timers
|
|
{
|
|
timeout = 90;
|
|
command = "${pkgs.systemd}/bin/systemd-ac-power || ${pkgs.niri-unstable}/bin/niri msg action power-off-monitors && ${pkgs.systemd}/bin/loginctl lock-session";
|
|
}
|
|
{
|
|
timeout = 180;
|
|
command = "${pkgs.systemd}/bin/systemd-ac-power || ${pkgs.systemd}/bin/systemctl suspend";
|
|
}
|
|
|
|
# ac power timers
|
|
{
|
|
timeout = 180;
|
|
command = "${pkgs.systemd}/bin/systemd-ac-power && ${pkgs.niri-unstable}/bin/niri msg action power-off-monitors && ${pkgs.systemd}/bin/loginctl lock-session";
|
|
}
|
|
{
|
|
timeout = 600;
|
|
command = "${pkgs.systemd}/bin/systemd-ac-power && ${pkgs.systemd}/bin/systemctl suspend";
|
|
}
|
|
];
|
|
|
|
};
|
|
|
|
programs.swaylock = {
|
|
enable = true;
|
|
package = pkgs.swaylock-plugin;
|
|
settings = {
|
|
color = "000000";
|
|
font-size = 32;
|
|
indicator-idle-visible = true;
|
|
indicator-radius = 350;
|
|
line-color = strPalette.normal.magenta;
|
|
show-failed-attempts = true;
|
|
grace = "10sec";
|
|
ignore-empty-password = true;
|
|
command = "${pkgs.wpaperd}/bin/wpaperd";
|
|
};
|
|
};
|
|
}
|