home/programs/swayidle: add configuration, setup with loginctl

This commit is contained in:
Anthony Rodriguez 2024-10-06 15:57:08 +02:00
parent 7f98200cd8
commit c5fdfffaf6
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
3 changed files with 31 additions and 4 deletions

View file

@ -9,6 +9,7 @@
"${self}/home/programs/fuzzel.nix" "${self}/home/programs/fuzzel.nix"
"${self}/home/programs/swaybg.nix" "${self}/home/programs/swaybg.nix"
"${self}/home/programs/swaylock.nix" "${self}/home/programs/swaylock.nix"
"${self}/home/programs/swayidle.nix"
"${self}/home/terminal/emulators/foot.nix" "${self}/home/terminal/emulators/foot.nix"

View file

@ -1,7 +1,11 @@
{config, ...}: let {
config,
pkgs,
lib,
...
}: let
appLauncher = "fuzzel"; appLauncher = "fuzzel";
terminal = "foot"; terminal = "foot";
screenLocker = "swaylock";
in { in {
programs.niri.settings.binds = { programs.niri.settings.binds = {
"Mod+D".action.spawn = appLauncher; "Mod+D".action.spawn = appLauncher;
@ -114,8 +118,10 @@ in {
"Alt+Print".action = config.lib.niri.actions.screenshot-window; "Alt+Print".action = config.lib.niri.actions.screenshot-window;
# System # System
"Mod+Shift+P".action = config.lib.niri.actions.power-off-monitors; "Mod+Alt+L".action.spawn = [
"Mod+Alt+L".action.spawn = screenLocker; "${lib.getExe' pkgs.systemd "loginctl"}"
"lock-session"
];
# Media keys # Media keys
"XF86AudioRaiseVolume" = { "XF86AudioRaiseVolume" = {

View file

@ -0,0 +1,20 @@
{
lib,
config,
...
}: {
services.swayidle = {
enable = true;
events = [
{
event = "lock";
command = "${lib.getExe config.programs.swaylock.package}";
}
{
event = "before-sleep";
command = "${lib.getExe config.programs.swaylock.package}";
}
];
};
systemd.user.services.swayidle.Unit.After = lib.mkForce ["graphical-session.target"];
}