Fallback for proxy configuration on Linux

This introduces a special fallback for platform detection that helps
with configuring the proxy settings on minimal (DE-less) setups.

Also unifies the check for proper $MODE value.
pull/7558/head
maximilionus 2025-07-09 03:28:12 +03:00
parent 7c1e1354c2
commit 1227d69b9f
1 changed files with 14 additions and 6 deletions

View File

@ -29,9 +29,6 @@ set_gnome_proxy() {
echo "Ignored Hosts: $IGNORE_HOSTS"
elif [ "$MODE" == "none" ]; then
echo "GNOME: Proxy disabled."
else
echo "GNOME: Invalid mode. Use 'none' or 'manual'."
exit 1
fi
}
@ -69,9 +66,6 @@ set_kde_proxy() {
# Disable proxy
$KWRITECONFIG --file kioslaverc --group "Proxy Settings" --key ProxyType 0
echo "KDE: Proxy disabled."
else
echo "KDE: Invalid mode. Use 'none' or 'manual'."
exit 1
fi
# Apply changes by restarting KDE's network settings
@ -117,6 +111,15 @@ detect_desktop_environment() {
return
fi
done
# Fallback to GNOME method if CLI utility is available. This solves the
# proxy configuration issues on minimal installation systems, like setups
# with only window managers, that borrow some parts from big DEs.
if command -v gsettings >/dev/null 2>&1; then
echo "gnome"
return
fi
echo "unsupported"
}
@ -134,6 +137,11 @@ PROXY_IP=$2
PROXY_PORT=$3
IGNORE_HOSTS=$4
if ! [[ "$MODE" =~ ^(manual|none)$ ]]; then
echo "Invalid mode. Use 'none' or 'manual'." >&2
exit 1
fi
# Detect desktop environment
DE=$(detect_desktop_environment)