From bde2e40362481d438e783fedf261ec1fb947feab Mon Sep 17 00:00:00 2001 From: omprakash Date: Wed, 6 May 2026 12:16:32 +0530 Subject: [PATCH] updated scripts to fix a bug remove_proxy wasnt removing proxy variables from current terminal and login session, and apply_proxy was modifying ~/.bashrc to make it so that proxy variables reload for every terminal and kde login session --- Arch/kde/README.md | 11 +++++++++++ Arch/kde/apply_proxy | 20 +++++++++++++++++++- Arch/kde/remove_proxy | 30 +++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Arch/kde/README.md b/Arch/kde/README.md index 0a0f76c..8596ef1 100644 --- a/Arch/kde/README.md +++ b/Arch/kde/README.md @@ -14,3 +14,14 @@ These scripts were made after realising that for my KDE Plasma setup, - pacman was showing errors regarding the XferCommand line, the reasons for which are yet to be understood by me. I also wanted to make the script change Firefox's proxy settings. + +--- + +## Changelog +**1)** remove_proxy.sh doesnt unset proxy variables from terminal (noticed from the fact that 'git push' never worked after removing proxy). +- apply_proxy.sh modifies the ~/.bashrc file to make it so that proxy variables are loaded back in for every terminal and for every kde login session. +- modified remove_proxy.sh such that it removes from current kde login session perfectly. +- test by running ```bash env | grep -i proxy``` in terminal before and after running remove_proxy.sh, proxy variables used to still be stored, new scripts make sure they dont. + + + diff --git a/Arch/kde/apply_proxy b/Arch/kde/apply_proxy index 74d8215..bd505f9 100755 --- a/Arch/kde/apply_proxy +++ b/Arch/kde/apply_proxy @@ -42,6 +42,8 @@ PROXY_HTTP="http://${AUTH}${PROXY_HOST}:${PROXY_PORT}" ################################# # System environment ################################# +echo "" +echo "Configuring environment variables...." sudo tee /etc/profile.d/proxy.sh >/dev/null </dev/null || true +echo "Done!!" ################################# # snap ################################# +echo "Configuring snap...." sudo systemctl restart snapd 2>/dev/null || true +echo "Done!!" ################################# # Firefox ################################# +echo "Configuring Firefox...." FF_PROFILE="$HOME/.mozilla/firefox/r3my975k.default-release" @@ -117,5 +133,7 @@ user_pref("network.proxy.share_proxy_settings", true); user_pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1"); EOF +echo "Done!!" echo echo "Proxy enabled!!" + diff --git a/Arch/kde/remove_proxy b/Arch/kde/remove_proxy index ee34323..ca6ec25 100755 --- a/Arch/kde/remove_proxy +++ b/Arch/kde/remove_proxy @@ -11,26 +11,36 @@ echo "=== Disable Proxy ===" ################################# # System env ################################# +echo "" +echo "Removing env varibles...." sudo rm -f /etc/profile.d/proxy.sh +echo "Done" + ################################# # git ################################# +echo "Removing from git...." git config --global --unset http.proxy || true git config --global --unset https.proxy || true + +echo "Done" ################################# # npm ################################# +echo "Removing from npm...." npm config delete proxy || true npm config delete https-proxy || true +echo "Done" ################################# # KDE Plasma GUI (Plasma 6) ################################# +echo "Removing from KDE Plasma...." # Use Plasma 6 tools KWRITE=kwriteconfig6 @@ -46,15 +56,19 @@ $KWRITE --file kioslaverc --group "Proxy Settings" --key socksProxy "" # Optional reload (may fail silently, that's fine) qdbus6 org.kde.KIO.Scheduler /KIO/Scheduler reparseSlaveConfiguration 2>/dev/null || true +echo "Done" ################################# # snap ################################# +echo "Removing from snap...." sudo systemctl restart snapd 2>/dev/null || true +echo "Done" ################################# # Firefox ################################# +echo "Removing from Firefox...." FF_PROFILE="/home/poke/.mozilla/firefox/r3my975k.default-release" @@ -62,6 +76,20 @@ cat > "$FF_PROFILE/user.js" </dev/null || true + +echo "Done" +echo "" echo "Proxy disabled everywhere."