diff --git a/home/programs/niri/binds.nix b/home/programs/niri/binds.nix index d402efd..7b5bbb6 100644 --- a/home/programs/niri/binds.nix +++ b/home/programs/niri/binds.nix @@ -8,14 +8,19 @@ terminal = "foot"; browser = "firefox"; prefix = "Alt"; + guiFileManager = "nautilus"; + cliFileManager = "${terminal} -e yazi"; in { programs.niri.settings.binds = { "${prefix}+D".action.spawn = appLauncher; "${prefix}+Return".action.spawn = terminal; "${prefix}+W".action.spawn = browser; - "${prefix}+Shift+E".action.quit.skip-confirmation = true; + "${prefix}+E".action.spawn = guiFileManager; + "${prefix}+Shift+E".action.spawn = cliFileManager; + "${prefix}+Shift+Slash".action = config.lib.niri.actions.show-hotkey-overlay; "${prefix}+Q".action = config.lib.niri.actions.close-window; + "${prefix}+Shift+Q".action.quit.skip-confirmation = true; "${prefix}+F".action = config.lib.niri.actions.maximize-column; "${prefix}+Shift+F".action = config.lib.niri.actions.fullscreen-window; "${prefix}+C".action = config.lib.niri.actions.center-column; @@ -157,5 +162,7 @@ in { "XF86AudioMedia" = { action.spawn = ["sh" "-c" "env XDG_CURRENT_DESKTOP=gnome gnome-control-center"]; }; + + "XF86PowerOff".action.spawn = "wlogout"; }; } diff --git a/home/programs/niri/default.nix b/home/programs/niri/default.nix index 2e4910d..445713f 100644 --- a/home/programs/niri/default.nix +++ b/home/programs/niri/default.nix @@ -26,9 +26,12 @@ in { programs.niri = { settings = { - input.keyboard.xkb = { - layout = "us"; - options = "compose:ralt"; + input = { + power-key-handling.enable = false; + keyboard.xkb = { + layout = "us"; + options = "compose:ralt"; + }; }; prefer-no-csd = true; @@ -117,4 +120,64 @@ in { Restart = "on-failure"; }; }; + + programs.wlogout = { + enable = true; + + layout = let + systemd = let + systemd = lib.getExe' pkgs.systemd; + in { + loginctl = systemd "loginctl"; + systemctl = systemd "systemctl"; + }; + in [ + { + action = "${systemd.loginctl} lock-session"; + keybind = "l"; + label = "lock"; + text = "Lock"; + } + + { + action = "${systemd.systemctl} hibernate"; + keybind = "h"; + label = "hibernate"; + text = "Hibernate"; + } + + { + action = "${ + systemd.loginctl + } terminate-user ${ + config.home.username + }"; + + keybind = "q"; + label = "logout"; + text = "Logout"; + } + + { + action = "${systemd.systemctl} poweroff"; + keybind = "p"; + label = "shutdown"; + text = "Shutdown"; + } + + { + action = "${systemd.systemctl} suspend"; + keybind = "s"; + label = "suspend"; + text = "Suspend"; + } + + { + action = "${systemd.systemctl} reboot"; + keybind = "r"; + label = "reboot"; + text = "Reboot"; + } + ]; + }; } diff --git a/system/services/logind.nix b/system/services/logind.nix index d7b9b86..44eb438 100644 --- a/system/services/logind.nix +++ b/system/services/logind.nix @@ -1,5 +1,9 @@ { services.logind = { lidSwitch = "suspend"; + extraConfig = '' + HandlePowerKey=ignore + HandlePowerKeyLongPress=poweroff + ''; }; } diff --git a/system/services/power.nix b/system/services/power.nix index 299522b..a5094e9 100644 --- a/system/services/power.nix +++ b/system/services/power.nix @@ -1,9 +1,5 @@ { services = { - logind.extraConfig = '' - HandlePowerKey=suspend - ''; - power-profiles-daemon.enable = true; # battery info