From d5c176c68b0c94f87c588bbee4d00b72805da34e Mon Sep 17 00:00:00 2001 From: iofq Date: Wed, 26 Apr 2023 04:36:08 -0500 Subject: [PATCH] add sway{lock, idle} --- hosts/configuration.nix | 1 + hosts/default.nix | 1 + hosts/home.nix | 1 + modules/wayland/default.nix | 24 +++++++++++++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/hosts/configuration.nix b/hosts/configuration.nix index 0bb7093..64ec338 100755 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -13,5 +13,6 @@ ]; }; users.groups.plugdev = {}; + security.pam.services.swaylock = {}; system.stateVersion = "22.11"; } diff --git a/hosts/default.nix b/hosts/default.nix index e02981c..c9305a5 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -33,6 +33,7 @@ in }; }; home-manager.users.${username} = { + programs.home-manager.enable = true; imports = [ ./home.nix ./t14/home.nix diff --git a/hosts/home.nix b/hosts/home.nix index ff0021d..84bf148 100755 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -10,5 +10,6 @@ ripgrep ]; }; + systemd.user.startServices = "sd-switch"; xdg.enable = true; } diff --git a/modules/wayland/default.nix b/modules/wayland/default.nix index a9a0981..f922c6a 100644 --- a/modules/wayland/default.nix +++ b/modules/wayland/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ home-manager, username, config, lib, pkgs, ... }: { home.packages = with pkgs; [ wl-clipboard @@ -65,6 +65,7 @@ "${modifier}+space" = "exec ${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --"; "${modifier}+bracketleft" = "exec --no-startup-id grimshot --notify save area /tmp/scrot-$(date \"+%Y-%m-%d\"T\"%H:%M:%S\").png"; "${modifier}+bracketright" = "exec --no-startup-id grimshot --notify copy area"; + "${modifier}+Shift+Ctrl+l" = "exec loginctl lock-session"; "XF86MonBrightnessDown" = "exec light -U 10"; "XF86MonBrightnessUp" = "exec light -A 10"; "XF86AudioRaiseVolume" = "exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'"; @@ -182,4 +183,25 @@ }; }; }; + programs.swaylock = { + enable = true; + settings = { + color = "#764783"; + daemonize = true; + clock = true; + ignore-empty-password = true; + }; + }; + services.swayidle = { + enable = true; + events = [ + { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock";} + { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock";} + { event = "after-resume"; command = "${pkgs.sway}/bin/swaymsg \"output * power on\"";} + ]; + timeouts = [ + { timeout = 600; command = "${pkgs.swaylock}/bin/swaylock";} + { timeout = 1200; command = "${pkgs.sway}/bin/swaymsg \"output * power off\"";} + ]; + }; }