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, ... }:
|
||||
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 {
|
||||
services.swayidle = {
|
||||
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 = [
|
||||
{
|
||||
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";
|
||||
layer = "top";
|
||||
output = [
|
||||
"!DP-2"
|
||||
"!DP-3"
|
||||
"!HDMI-A-2"
|
||||
"!${config.displays.tower2}"
|
||||
"!${config.displays.tower3}"
|
||||
"!${config.displays.estradiol2}"
|
||||
"*"
|
||||
];
|
||||
modules-left = [
|
||||
|
@ -268,9 +268,9 @@
|
|||
position = "top";
|
||||
layer = "top";
|
||||
output = [
|
||||
"DP-2"
|
||||
"DP-3"
|
||||
"HDMI-A-2"
|
||||
config.displays.tower2
|
||||
config.displays.tower3
|
||||
config.displays.estradiol2
|
||||
];
|
||||
modules-left = [
|
||||
"sway/workspaces"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue