Logout script

This commit is contained in:
Filippo Berto 2022-05-21 23:47:50 +02:00
parent 87518f28fa
commit ed0ae48c75

View file

@ -13,6 +13,10 @@ let
systemctl = "${pkgs.systemd}/bin/systemctl"; systemctl = "${pkgs.systemd}/bin/systemctl";
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
shutdown = "${pkgs.systemd}/bin/shutdown"; shutdown = "${pkgs.systemd}/bin/shutdown";
logout = pkgs.writeShellScript "logout" ''
session=`${loginctl} session-status | ${pkgs.coreutils}/bin/head -n 1 | ${pkgs.gawk}/bin/awk '{print $1}'`
${loginctl} terminate-session $session
'';
colors = with pkgs.rice; palette.toARGBHex rec { colors = with pkgs.rice; palette.toARGBHex rec {
normal = { normal = {
@ -314,7 +318,7 @@ in
({ text = "Power off"; exec = "#powermenu.open.4"; }) ({ text = "Power off"; exec = "#powermenu.open.4"; })
] ]
[ [
({ text = "Logout"; exec = "${loginctl} terminate-session `loginctl session-status | head -n 1 | awk '{print $1}'`"; }) ({ text = "Logout"; exec = logout; })
] ]
[ [
({ text = "Reboot"; exec = "${systemctl} reboot"; }) ({ text = "Reboot"; exec = "${systemctl} reboot"; })