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
playerctl
jq
psmisc
swaylock
swayidle

View file

@ -1,4 +1,7 @@
{ pkgs, nixosConfig, lib, ... }:
let
lockCmd = "${pkgs.swaylock}/bin/swaylock -c 100000ff";
in
{
wayland.windowManager.sway = {
enable = true;
@ -41,6 +44,16 @@
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 =
let
mod = "Mod4";
@ -105,7 +118,7 @@
"XF86AudioRaiseVolume" =
"exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
# Tools, AudioMute, AudioLowerVolume
"XF86Tools" = "exec loginctl lock-session";
"XF86Tools" = "exec killall -USR1 swayidle";
"XF86AudioMute" =
"exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle";
"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/fonts.nix
../modules/opengl.nix
../modules/pam.nix
../modules/sound.nix
../modules/ssh.nix
../modules/docker.nix