treewide: spawn wlogout on power button short press
This commit is contained in:
parent
881ffab221
commit
bc2ebd6c82
4 changed files with 78 additions and 8 deletions
|
@ -8,14 +8,19 @@
|
||||||
terminal = "foot";
|
terminal = "foot";
|
||||||
browser = "firefox";
|
browser = "firefox";
|
||||||
prefix = "Alt";
|
prefix = "Alt";
|
||||||
|
guiFileManager = "nautilus";
|
||||||
|
cliFileManager = "${terminal} -e yazi";
|
||||||
in {
|
in {
|
||||||
programs.niri.settings.binds = {
|
programs.niri.settings.binds = {
|
||||||
"${prefix}+D".action.spawn = appLauncher;
|
"${prefix}+D".action.spawn = appLauncher;
|
||||||
"${prefix}+Return".action.spawn = terminal;
|
"${prefix}+Return".action.spawn = terminal;
|
||||||
"${prefix}+W".action.spawn = browser;
|
"${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}+Shift+Slash".action = config.lib.niri.actions.show-hotkey-overlay;
|
||||||
"${prefix}+Q".action = config.lib.niri.actions.close-window;
|
"${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}+F".action = config.lib.niri.actions.maximize-column;
|
||||||
"${prefix}+Shift+F".action = config.lib.niri.actions.fullscreen-window;
|
"${prefix}+Shift+F".action = config.lib.niri.actions.fullscreen-window;
|
||||||
"${prefix}+C".action = config.lib.niri.actions.center-column;
|
"${prefix}+C".action = config.lib.niri.actions.center-column;
|
||||||
|
@ -157,5 +162,7 @@ in {
|
||||||
"XF86AudioMedia" = {
|
"XF86AudioMedia" = {
|
||||||
action.spawn = ["sh" "-c" "env XDG_CURRENT_DESKTOP=gnome gnome-control-center"];
|
action.spawn = ["sh" "-c" "env XDG_CURRENT_DESKTOP=gnome gnome-control-center"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"XF86PowerOff".action.spawn = "wlogout";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,12 @@ in {
|
||||||
|
|
||||||
programs.niri = {
|
programs.niri = {
|
||||||
settings = {
|
settings = {
|
||||||
input.keyboard.xkb = {
|
input = {
|
||||||
layout = "us";
|
power-key-handling.enable = false;
|
||||||
options = "compose:ralt";
|
keyboard.xkb = {
|
||||||
|
layout = "us";
|
||||||
|
options = "compose:ralt";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
prefer-no-csd = true;
|
prefer-no-csd = true;
|
||||||
|
@ -117,4 +120,64 @@ in {
|
||||||
Restart = "on-failure";
|
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";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
{
|
{
|
||||||
services.logind = {
|
services.logind = {
|
||||||
lidSwitch = "suspend";
|
lidSwitch = "suspend";
|
||||||
|
extraConfig = ''
|
||||||
|
HandlePowerKey=ignore
|
||||||
|
HandlePowerKeyLongPress=poweroff
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
{
|
{
|
||||||
services = {
|
services = {
|
||||||
logind.extraConfig = ''
|
|
||||||
HandlePowerKey=suspend
|
|
||||||
'';
|
|
||||||
|
|
||||||
power-profiles-daemon.enable = true;
|
power-profiles-daemon.enable = true;
|
||||||
|
|
||||||
# battery info
|
# battery info
|
||||||
|
|
Loading…
Reference in a new issue