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 {pkgs, ...}: let
logout-utility = pkgs.writeShellScriptBin "logout-utility" (builtins.readFile ./scripts/logout-utility);
powermenu = pkgs.writeShellScriptBin "powermenu" (builtins.readFile ./scripts/powermenu); powermenu = pkgs.writeShellScriptBin "powermenu" (builtins.readFile ./scripts/powermenu);
power-profiles = pkgs.writeShellScriptBin "power-profiles" (builtins.readFile ./scripts/power-profiles); power-profiles = pkgs.writeShellScriptBin "power-profiles" (builtins.readFile ./scripts/power-profiles);
in { in {
imports = [../gui/foot.nix ./gtk.nix]; imports = [../gui/foot.nix ./gtk.nix];
home.packages = [powermenu power-profiles]; home.packages = [logout-utility powermenu power-profiles];
programs.rofi = { programs.rofi = {
enable = true; enable = true;
location = "center"; 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" [ Suspend]="systemctl suspend"
[ Hibernate]="systemctl hibernate" [ Hibernate]="systemctl hibernate"
[ Lock]="hyprctl dispatch exec swaylock" [ Lock]="hyprctl dispatch exec swaylock"
[ Logout]="hyprctl dispatch exit" [ Logout]="logout-utility"
[ Cancel]="" [ Cancel]=""
) )