sway: Add swaylock and swayidle

This commit is contained in:
fleaz 2022-03-02 00:00:03 +01:00
parent be49bc0169
commit d4ee062827
4 changed files with 20 additions and 1 deletions

View file

@ -70,6 +70,7 @@ in
pavucontrol pavucontrol
playerctl playerctl
jq jq
psmisc
swaylock swaylock
swayidle swayidle

View file

@ -1,4 +1,7 @@
{ pkgs, nixosConfig, lib, ... }: { pkgs, nixosConfig, lib, ... }:
let
lockCmd = "${pkgs.swaylock}/bin/swaylock -c 100000ff";
in
{ {
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
@ -41,6 +44,16 @@
bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
startup = [
{ command = ''${pkgs.swayidle}/bin/swayidle -w \
timeout 300 "${lockCmd}" \
timeout 600 "${pkgs.sway}/bin/swaymsg output * dpms off" \
resume "${pkgs.sway}/bin/swaymsg output * dpms on" \
before-sleep "${lockCmd}"''; }
];
keybindings = keybindings =
let let
mod = "Mod4"; mod = "Mod4";
@ -105,7 +118,7 @@
"XF86AudioRaiseVolume" = "XF86AudioRaiseVolume" =
"exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; "exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
# Tools, AudioMute, AudioLowerVolume # Tools, AudioMute, AudioLowerVolume
"XF86Tools" = "exec loginctl lock-session"; "XF86Tools" = "exec killall -USR1 swayidle";
"XF86AudioMute" = "XF86AudioMute" =
"exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"; "exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioLowerVolume" = "XF86AudioLowerVolume" =

4
modules/pam.nix Normal file
View file

@ -0,0 +1,4 @@
{
# Allow swaylock to talk to PAM
security.pam.services.swaylock = {};
}

View file

@ -5,6 +5,7 @@
../modules/earlyoom.nix ../modules/earlyoom.nix
../modules/fonts.nix ../modules/fonts.nix
../modules/opengl.nix ../modules/opengl.nix
../modules/pam.nix
../modules/sound.nix ../modules/sound.nix
../modules/ssh.nix ../modules/ssh.nix
../modules/docker.nix ../modules/docker.nix