2025-01-27 23:30:24 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2025-02-23 00:01:57 +01:00
|
|
|
inherit (builtins) concatStringsSep map;
|
|
|
|
inherit (lib.meta) getExe';
|
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
|
2025-01-27 23:30:24 +01:00
|
|
|
inherit (config.local.systemVars) username;
|
|
|
|
|
|
|
|
mkLayout = items: let
|
|
|
|
formatItem = item: ''
|
|
|
|
{
|
|
|
|
"label" : "${item.label}",
|
|
|
|
"action" : "${item.action}",
|
|
|
|
"text" : "${item.text}",
|
|
|
|
"keybind" : "${item.keybind}"
|
|
|
|
}'';
|
|
|
|
in
|
2025-02-23 00:01:57 +01:00
|
|
|
concatStringsSep "\n" (map formatItem items);
|
2025-01-27 23:30:24 +01:00
|
|
|
in {
|
2025-02-23 00:01:57 +01:00
|
|
|
config = mkIf config.local.modules.hyprland.enable {
|
2025-01-27 23:30:24 +01:00
|
|
|
hjem.users.${username} = {
|
|
|
|
packages = [pkgs.wlogout];
|
|
|
|
files = {
|
|
|
|
".config/wlogout/layout".text = let
|
2025-02-23 00:01:57 +01:00
|
|
|
loginctl = getExe' pkgs.systemd "loginctl";
|
|
|
|
systemctl = getExe' pkgs.systemd "systemctl";
|
2025-01-27 23:30:24 +01:00
|
|
|
in
|
|
|
|
mkLayout [
|
|
|
|
{
|
|
|
|
action = "${loginctl} lock-session";
|
|
|
|
keybind = "l";
|
|
|
|
label = "lock";
|
|
|
|
text = "Lock";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
action = "${systemctl} hibernate";
|
|
|
|
keybind = "h";
|
|
|
|
label = "hibernate";
|
|
|
|
text = "Hibernate";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
action = "${loginctl} terminate-user ${username}";
|
|
|
|
|
|
|
|
keybind = "q";
|
|
|
|
label = "logout";
|
|
|
|
text = "Logout";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
action = "${systemctl} poweroff";
|
|
|
|
keybind = "p";
|
|
|
|
label = "shutdown";
|
|
|
|
text = "Shutdown";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
action = "${systemctl} suspend";
|
|
|
|
keybind = "s";
|
|
|
|
label = "suspend";
|
|
|
|
text = "Suspend";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
action = "${systemctl} reboot";
|
|
|
|
keybind = "r";
|
|
|
|
label = "reboot";
|
|
|
|
text = "Reboot";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|