From a02a122dd107ebccb6ce317150ed4de57344a933 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 16 Mar 2025 11:01:23 +0800 Subject: [PATCH] Update proxy_set_linux_sh https://github.com/2dust/v2rayN/issues/6886 --- v2rayN/ServiceLib/Sample/proxy_set_linux_sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Sample/proxy_set_linux_sh b/v2rayN/ServiceLib/Sample/proxy_set_linux_sh index 50844a45..a1caae53 100644 --- a/v2rayN/ServiceLib/Sample/proxy_set_linux_sh +++ b/v2rayN/ServiceLib/Sample/proxy_set_linux_sh @@ -80,13 +80,19 @@ set_kde_proxy() { # Detect the current desktop environment detect_desktop_environment() { - if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ] || [ "$XDG_CURRENT_DESKTOP" == "ubuntu:GNOME" ] || [ "$XDG_SESSION_DESKTOP" == "GNOME" ] || [ "$XDG_SESSION_DESKTOP" == "ubuntu:GNOME" ]; then + if [[ "$XDG_CURRENT_DESKTOP" == *"GNOME"* ]] || [[ "$XDG_SESSION_DESKTOP" == *"GNOME"* ]]; then echo "gnome" - elif [ "$XDG_CURRENT_DESKTOP" == "KDE" ] || [ "$XDG_CURRENT_DESKTOP" == "plasma" ] || [ "$XDG_SESSION_DESKTOP" == "KDE" ] || [ "$XDG_SESSION_DESKTOP" == "plasma" ]; then - echo "kde" - else - echo "unsupported" + return fi + + local KDE_ENVIRONMENTS=("KDE" "plasma") + for ENV in "${KDE_ENVIRONMENTS[@]}"; do + if [ "$XDG_CURRENT_DESKTOP" == "$ENV" ] || [ "$XDG_SESSION_DESKTOP" == "$ENV" ]; then + echo "kde" + return + fi + done + echo "unsupported" } # Main script logic