Skip to content

Commit a02a122

Browse files
committed
Update proxy_set_linux_sh
#6886
1 parent 7011386 commit a02a122

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

v2rayN/ServiceLib/Sample/proxy_set_linux_sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,19 @@ set_kde_proxy() {
8080

8181
# Detect the current desktop environment
8282
detect_desktop_environment() {
83-
if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ] || [ "$XDG_CURRENT_DESKTOP" == "ubuntu:GNOME" ] || [ "$XDG_SESSION_DESKTOP" == "GNOME" ] || [ "$XDG_SESSION_DESKTOP" == "ubuntu:GNOME" ]; then
83+
if [[ "$XDG_CURRENT_DESKTOP" == *"GNOME"* ]] || [[ "$XDG_SESSION_DESKTOP" == *"GNOME"* ]]; then
8484
echo "gnome"
85-
elif [ "$XDG_CURRENT_DESKTOP" == "KDE" ] || [ "$XDG_CURRENT_DESKTOP" == "plasma" ] || [ "$XDG_SESSION_DESKTOP" == "KDE" ] || [ "$XDG_SESSION_DESKTOP" == "plasma" ]; then
86-
echo "kde"
87-
else
88-
echo "unsupported"
85+
return
8986
fi
87+
88+
local KDE_ENVIRONMENTS=("KDE" "plasma")
89+
for ENV in "${KDE_ENVIRONMENTS[@]}"; do
90+
if [ "$XDG_CURRENT_DESKTOP" == "$ENV" ] || [ "$XDG_SESSION_DESKTOP" == "$ENV" ]; then
91+
echo "kde"
92+
return
93+
fi
94+
done
95+
echo "unsupported"
9096
}
9197

9298
# Main script logic

0 commit comments

Comments
 (0)