Fix the hell out of Swaylock
This commit is contained in:
parent
b532ebb5ae
commit
5cdd7b1de8
2 changed files with 44 additions and 26 deletions
|
@ -1,31 +1,49 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
lockcommand = "${pkgs.swaylock-effects}/bin/swaylock --daemonize";
|
||||||
|
unlockcommand = "pkill -SIGUSR1 swaylock";
|
||||||
|
timeoutcommand = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
|
||||||
|
resumecommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.home.desktop.enable {
|
config = lib.mkIf config.home.desktop.enable {
|
||||||
services.swayidle = {
|
services.swayidle = {
|
||||||
enable = config.home.desktop.enable;
|
enable = config.home.desktop.enable;
|
||||||
timeouts = [
|
|
||||||
{
|
|
||||||
timeout = 1800;
|
|
||||||
command = "notify-send 'Locking in 30 seconds'";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timeout = 1830;
|
|
||||||
command = "swaylock";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timeout = 3600;
|
|
||||||
command = "swaymsg 'output * dpms off'";
|
|
||||||
resumeCommand = "swaymsg 'output * dpms on'";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timeout = 3605;
|
|
||||||
command = "systemctl suspend";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
events = [
|
events = [
|
||||||
{
|
{
|
||||||
event = "before-sleep";
|
event = "before-sleep";
|
||||||
command = "swaylock";
|
command = lockcommand;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "lock";
|
||||||
|
command = lockcommand;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "unlock";
|
||||||
|
command = unlockcommand;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "after-resume";
|
||||||
|
command = resumecommand;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
timeouts = [
|
||||||
|
{
|
||||||
|
timeout = 1800; # 30m
|
||||||
|
command = "${pkgs.libnotify}/bin/notify-send \"Locking in 30 seconds\"";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 1830;
|
||||||
|
command = lockcommand;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 3600; # 1h
|
||||||
|
command = timeoutcommand;
|
||||||
|
resumeCommand = resumecommand;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 3605;
|
||||||
|
command = "${pkgs.systemd}/bin/systemctl suspend";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -217,9 +217,9 @@
|
||||||
position = "top";
|
position = "top";
|
||||||
layer = "top";
|
layer = "top";
|
||||||
output = [
|
output = [
|
||||||
"!DP-2"
|
"!${config.displays.tower2}"
|
||||||
"!DP-3"
|
"!${config.displays.tower3}"
|
||||||
"!HDMI-A-2"
|
"!${config.displays.estradiol2}"
|
||||||
"*"
|
"*"
|
||||||
];
|
];
|
||||||
modules-left = [
|
modules-left = [
|
||||||
|
@ -268,9 +268,9 @@
|
||||||
position = "top";
|
position = "top";
|
||||||
layer = "top";
|
layer = "top";
|
||||||
output = [
|
output = [
|
||||||
"DP-2"
|
config.displays.tower2
|
||||||
"DP-3"
|
config.displays.tower3
|
||||||
"HDMI-A-2"
|
config.displays.estradiol2
|
||||||
];
|
];
|
||||||
modules-left = [
|
modules-left = [
|
||||||
"sway/workspaces"
|
"sway/workspaces"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue