furthre config on laptop
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
# config swayidle
|
||||
services.swayidle =
|
||||
let
|
||||
# Lock command
|
||||
lock = "${pkgs.swaylock}/bin/swaylock --daemonize";
|
||||
# TODO: modify "display" function based on your window manager
|
||||
# Sway
|
||||
display = status: "swaymsg 'output * power ${status}'";
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 295; # in seconds
|
||||
command = "${pkgs.libnotify}/bin/notify-send 'Locking in 5 seconds' -t 5000";
|
||||
}
|
||||
{
|
||||
timeout = 300;
|
||||
command = lock;
|
||||
}
|
||||
{
|
||||
timeout = 305;
|
||||
command = display "off";
|
||||
resumeCommand = display "on";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${pkgs.systemd}/bin/systemctl suspend-then-hibernate";
|
||||
}
|
||||
];
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
# adding duplicated entries for the same event may not work
|
||||
command = (display "off") + "; " + lock;
|
||||
}
|
||||
{
|
||||
event = "after-resume";
|
||||
command = display "on";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = (display "off") + "; " + lock;
|
||||
}
|
||||
{
|
||||
event = "unlock";
|
||||
command = display "on";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user