feat(desktop-return): make desktop environment detection case-insensitive

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-06-10 08:43:20 +05:00
parent 187546dba6
commit bc2f8293f2

View File

@ -5,23 +5,20 @@
CONFIG_FILE="$HOME/.config/gamescope-session-type" CONFIG_FILE="$HOME/.config/gamescope-session-type"
if [[ -f "$CONFIG_FILE" ]] && grep -q 'autologin=true' "$CONFIG_FILE"; then if [[ -f "$CONFIG_FILE" ]] && grep -q 'autologin=true' "$CONFIG_FILE"; then
case "$XDG_CURRENT_DESKTOP" in XDG_DESKTOP=$(echo "${XDG_CURRENT_DESKTOP,,}")
GNOME)
exec gnome-session-quit --no-prompt if [[ "$XDG_DESKTOP" == *gnome* ]]; then
;; exec gnome-session-quit --no-prompt
KDE) elif [[ "$XDG_DESKTOP" == *kde* ]]; then
VERSION=$(grep -E '^X-KDE-PluginInfo-Version=' /usr/share/xsessions/plasmax11.desktop 2>/dev/null | cut -d'=' -f2) VERSION=$(grep -E '^X-KDE-PluginInfo-Version=' /usr/share/xsessions/plasmax11.desktop 2>/dev/null | cut -d'=' -f2)
if [[ "$VERSION" =~ ^6\..* ]]; then if [[ "$VERSION" =~ ^6\..* ]]; then
exec qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout exec qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
else else
exec qdbus org.kde.ksmserver /KSMServer logout 0 0 0 exec qdbus org.kde.ksmserver /KSMServer logout 0 0 0
fi fi
;; elif [[ "$XDG_DESKTOP" == *mate* ]]; then
MATE) exec mate-session-save --force-logout
exec mate-session-save --force-logout elif [[ "$XDG_DESKTOP" == *hyprland* ]]; then
;; exec loginctl terminate-user "$(id -u)"
Hyprland) fi
exec loginctl terminate-user "$(id -u)"
;;
esac
fi fi