Skip to content

rezasadid753/syncproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

⚙️ SyncProxy for Linux

Platform Bash Dependencies License

System-wide proxy synchronization for the modern Linux desktop.
Automatically mirror your GNOME proxy settings to APT, Terminal environments, and system services.


📖 The Problem & The Solution

The Problem: GNOME’s built-in proxy settings are convenient for GUI applications like Firefox or Chrome, but they are notoriously "lazy." They often fail to apply to essential system components like apt, curl, wget, or new terminal sessions.

The Solution: SyncProxy is a lightweight, zero-dependency bash script that bridges this gap. It monitors your GNOME settings in real-time and injects them system-wide, ensuring that when you toggle your proxy on your desktop, your whole OS follows suit.


✨ Key Features

  • 🛡️ System-wide Coverage: Automatically configures apt, apt-get, and shell environment variables.
  • 🔄 Real-time Monitoring: A background daemon watches for GNOME setting changes and updates the system instantly.
  • 🖱️ Desktop Toggle: Includes a .desktop launcher so you can refresh or toggle proxy status from your app grid.
  • 🎨 Dynamic Icons: The launcher icon changes color/style based on whether the proxy is active or inactive.
  • 📦 Zero-Clutter Installation: Installs into a single directory in your home folder with an automated setup.
  • 🧹 Deep Uninstall: Completely reverts all system changes and environment files with one flag.

🧬 How It Works

graph TD
    A[GNOME Proxy Settings] -->|GSettings Monitor| B(SyncProxy Daemon)
    B --> C{Settings Changed?}
    C -- Yes --> D[Update /etc/apt/apt.conf.d/]
    C -- Yes --> E[Update /etc/profile.d/gnome-proxy.sh]
    C -- Yes --> F[Update Desktop Icon Status]
    D --> G[System-Wide Consistency]
    E --> G
    F --> G
    
    style B fill:#f9f,stroke:#333,stroke-width:2px
    style G fill:#bbf,stroke:#333,stroke-width:2px
Loading

🚀 Installation

SyncProxy handles its own environment setup. Just run the following commands:

# 1. Download the script
curl -o syncproxy.sh https://raw.githubusercontent.com/rezasadid753/syncproxy/main/syncproxy.sh

# 2. Make it executable
chmod +x syncproxy.sh

# 3. Run the installer
sudo ./syncproxy.sh

🖱️ Usage

Desktop Integration

Search for "SyncProxy" in your applications menu.

  • Toggling: Clicking the icon will trigger a sync and update system variables.
  • Visual Check: The icon in your launcher/dock will visually indicate the proxy state.

Command Line

You can manually trigger a sync or monitor at any time:

# Manual Sync
sudo ~/syncproxy/syncproxy.sh

# Apply to current shell session immediately
source /etc/profile.d/gnome-proxy.sh

📂 Technical Implementation Details

SyncProxy interacts with your system in four specific ways:

  1. GSettings: Reads org.gnome.system.proxy values.
  2. APT Config: Writes to /etc/apt/apt.conf.d/99proxy to ensure package updates work behind the wall.
  3. Environment Variables: Manages /etc/profile.d/gnome-proxy.sh to export http_proxy, https_proxy, and ftp_proxy.
  4. Autostart: Places a monitor entry in ~/.config/autostart/ to keep the sync daemon alive across reboots.

🧹 Uninstallation

To completely remove SyncProxy and revert all configuration changes:

sudo ~/syncproxy/syncproxy.sh --uninstall

📁 Directory Structure

SyncProxy keeps its files localized to avoid system clutter:

~/syncproxy/
├── syncproxy.sh    # Main logic & daemon
├── on.svg          # Active state icon
└── off.svg         # Inactive state icon

🤝 Acknowledgements

Inspired by the need for a seamless experience when using tools like Hiddify on Linux distributions where system-wide proxy support is inconsistent.


Built for a more connected Linux experience. 🌐

About

Sync Hiddify desktop app proxy with your terminal — export http/https/all_proxy vars automatically and use the same proxy in curl, git, apt, etc. Works in any DE, not just GNOME.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages