Add middlelayer to select corrent logout method per desktop environment

This commit is contained in:
Evie Litherland-Smith 2023-06-06 07:19:17 +01:00
parent 5d17437fc9
commit 3614eb1353
3 changed files with 12 additions and 2 deletions

View file

@ -1,9 +1,10 @@
{pkgs, ...}: let
logout-utility = pkgs.writeShellScriptBin "logout-utility" (builtins.readFile ./scripts/logout-utility);
powermenu = pkgs.writeShellScriptBin "powermenu" (builtins.readFile ./scripts/powermenu);
power-profiles = pkgs.writeShellScriptBin "power-profiles" (builtins.readFile ./scripts/power-profiles);
in {
imports = [../gui/foot.nix ./gtk.nix];
home.packages = [powermenu power-profiles];
home.packages = [logout-utility powermenu power-profiles];
programs.rofi = {
enable = true;
location = "center";

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if [[ "$XDG_CURRENT_DESKTOP" == "Hyprland" ]]; then
hyprctl dispatch exit
elif [[ "$XDG_CURRENT_DESKTOP" == "sway" ]]; then
swaymsg exit
else
echo "Unsupported desktop environment $XDG_CURRENT_DESKTOP"
fi

View file

@ -118,7 +118,7 @@ menu=(
[ Suspend]="systemctl suspend"
[ Hibernate]="systemctl hibernate"
[ Lock]="hyprctl dispatch exec swaylock"
[ Logout]="hyprctl dispatch exit"
[ Logout]="logout-utility"
[ Cancel]=""
)