Last active
September 20, 2023 09:50
-
-
Save moetelo/84c8bc791f9db5de379857953410500d to your computer and use it in GitHub Desktop.
Toggles proxy in kde5 assuming that proxy settings are set up.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the current proxy type | |
current_proxy_type=$(kreadconfig5 --file kioslaverc --group "Proxy Settings" --key ProxyType) | |
if [ $? -ne 0 ]; then | |
echo "Failed to execute kreadconfig5" | |
exit 1 | |
fi | |
# Toggle the proxy type | |
toggled_proxy_type=$((current_proxy_type == 1 ? 0 : 1)) | |
# Update the proxy type | |
kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key ProxyType "$toggled_proxy_type" | |
if [ $? -ne 0 ]; then | |
echo "kwriteconfig5 error" | |
exit 1 | |
fi | |
echo "$toggled_proxy_type" |
Author
moetelo
commented
Sep 20, 2023
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment