Add swaylock.
This commit is contained in:
parent
1535800e2f
commit
9abe43096b
@ -260,6 +260,7 @@ in
|
|||||||
./graphical_session_target.nix
|
./graphical_session_target.nix
|
||||||
./iso.nix
|
./iso.nix
|
||||||
./rofimoji.nix
|
./rofimoji.nix
|
||||||
|
./lockscreen.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.me.swayIncludes = lib.mkOption {
|
options.me.swayIncludes = lib.mkOption {
|
||||||
|
33
nix/configuration/roles/sway/lockscreen.nix
Normal file
33
nix/configuration/roles/sway/lockscreen.nix
Normal 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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user