Add swaylock.

This commit is contained in:
Tom Alexander 2025-01-18 18:13:30 -05:00
parent 1535800e2f
commit 9abe43096b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 34 additions and 0 deletions

View File

@ -260,6 +260,7 @@ in
./graphical_session_target.nix
./iso.nix
./rofimoji.nix
./lockscreen.nix
];
options.me.swayIncludes = lib.mkOption {

View File

@ -0,0 +1,33 @@
{
config,
lib,
pkgs,
...
}:
let
lockscreen_sway_config = pkgs.writeTextFile {
name = "lockscreen.conf";
text = ''
set $lock ${pkgs.swaylock}/bin/swaylock -f -c 000000
# Hotkey to lock the screen
bindsym $mod+l exec $lock
exec ${pkgs.swayidle}/bin/swayidle -w \
timeout 300 '$lock' \
timeout 600 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \
resume '${pkgs.sway}/bin/swaymsg "output * dpms on"' \
before-sleep '$lock'
'';
};
in
{
imports = [ ];
config = lib.mkIf config.me.graphical {
me.swayIncludes = [
lockscreen_sway_config
];
};
}