A clean, automated installer for adding a WireGuard VPN toggle to Omarchy's Waybar status bar. Provides a convenient visual indicator and quick toggle for your WireGuard VPN connections.
Based on the guide from Omarchy Discussion #1366.
- 🔒 One-click VPN toggle - Left-click to connect/disconnect
- 🎨 Visual status indicator - Integrates with Omarchy's icon theming
- 🔄 Profile switching - Right-click menu to switch between VPN configs
- ⚡ Passwordless operation - Optional sudoers configuration
- 🛡️ The Omarchy way - All scripts follow Omarchy bash practices with proper error handling
- 📦 Automated installation - Simple installer handles everything for Omarchy setups
- Omarchy - This VPN toggle is designed to integrate with Omarchy's Waybar configuration
- Bash 4.0+
- WireGuard (
wireguard-tools) - jq (JSON processor for safe config manipulation)
- WireGuard configuration files in
/etc/wireguard/
Since Omarchy is designed for Arch Linux:
sudo pacman -S wireguard-tools waybar jqInstall directly from GitHub with a single command:
Using curl:
curl -fsSL https://raw.githubusercontent.com/JacobusXIII/omarchy-wireguard-vpn-toggle/main/install.sh | bashUsing wget:
wget -qO- https://raw.githubusercontent.com/JacobusXIII/omarchy-wireguard-vpn-toggle/main/install.sh | bashThis will:
- Automatically detect one-liner mode
- Download the repository to /tmp
- Run the full installation with interactive prompts
- Clean up temporary files when done
- Ask for sudoers configuration (optional passwordless toggling)
Note: You'll need WireGuard configuration files before the VPN toggle will work (see step 2 below).
git clone https://github.com/JacobusXIII/omarchy-wireguard-vpn-toggle.git
cd omarchy-wireguard-vpn-toggleIf you haven't already, you need WireGuard configuration files in /etc/wireguard/.
For ProtonVPN users:
- Visit the ProtonVPN downloads page
- Download WireGuard configuration files
- Copy them to
/etc/wireguard/:sudo cp your-config.conf /etc/wireguard/
- Set proper permissions (600 or stricter):
sudo chmod 600 /etc/wireguard/*.conf
See the ProtonVPN WireGuard guide for detailed instructions.
For other VPN providers:
Most VPN providers offer WireGuard configuration files. Download them and place in /etc/wireguard/, then ensure they have proper permissions (600 or stricter) with sudo chmod 600 /etc/wireguard/*.conf.
./install.shThe installer will:
- ✅ Check for required dependencies
- ✅ Verify WireGuard configurations exist
- ✅ Install scripts to
~/.config/waybar/scripts/ - ✅ Add
custom/vpnmodule to Omarchy's Waybar config (after network module) - ✅ Add
#custom-vpnto style.css alongside#custom-omarchy - ✅ Optionally configure sudoers for passwordless operation
killall waybar && waybar &Or restart your compositor.
Left-click on the VPN icon in Omarchy's Waybar to connect or disconnect.
Right-click on the VPN icon to open an interactive menu where you can select a different WireGuard configuration.
You can also use the scripts directly from the command line:
# Toggle VPN on/off
~/.config/waybar/scripts/vpn-toggle.sh
# Check current status
~/.config/waybar/scripts/vpn-status.sh
# Select VPN profile
~/.config/waybar/scripts/vpn-select.shThe installer automatically adds #custom-vpn to your style.css alongside other icons:
#custom-omarchy,
#custom-vpn {
/* Your existing Omarchy icon styles */
}By default, the VPN icon inherits the same styling as your other custom modules (colors, spacing, etc.). You can customize this by:
- Keeping it grouped with other icons to inherit their styles
- Separating it to apply custom styles only to the VPN icon:
#custom-vpn { color: #your-color; /* Your custom styles */ }
The VPN icons can be changed by editing your Omarchy Waybar config's format-icons:
"format-icons": {
"default": "", // Default/fallback icon (blank)
"none": "", // No config
"connected": "", // VPN connected
"disconnected": "" // VPN disconnected
}Replace the Nerd Font icons with your preferred icons or emoji.
omarchy-wireguard-vpn-toggle/
├── scripts/ # VPN toggle scripts
│ ├── vpn-status.sh # Checks VPN connection status
│ ├── vpn-toggle.sh # Toggles VPN on/off
│ └── vpn-select.sh # Interactive VPN profile selector
├── install.sh # Main installer script
├── LICENSE # MIT License
├── README.md # This file
└── .gitignore
The installer creates/modifies these files:
In ~/.config/waybar/scripts/:
vpn-status.sh- Checks VPN connection status (returns JSON with icon state)vpn-toggle.sh- Toggles VPN on/offvpn-select.sh- Interactive VPN profile selectorvpn.conf- Stores currently selected VPN configuration
In ~/.config/waybar/:
config.jsoncorconfig- Waybar config (adds custom/vpn module with format-icons)style.css- Waybar styles (adds #custom-vpn alongside #custom-omarchy)*.backup.YYYYMMDD-HHMMSS- Timestamped backups of modified files
If you're prompted for a password when toggling VPN:
- Run the installer again and choose to configure sudoers
- Or manually add this line using
sudo visudo:%wheel ALL=(ALL) NOPASSWD: /usr/bin/wg-quick
-
Check Waybar config is valid JSON:
cat ~/.config/waybar/config.jsonc | jq
-
Ensure scripts are executable:
chmod +x ~/.config/waybar/scripts/vpn-*.sh
-
Check Waybar logs:
journalctl --user -u waybar -f
-
Verify scripts exist:
ls -lh ~/.config/waybar/scripts/vpn-*.sh
Ensure you have .conf files in /etc/wireguard/:
ls -lh /etc/wireguard/If empty, download configuration files from your VPN provider.
Test manually to identify the issue:
# Try connecting manually
sudo wg-quick up your-config-name
# Check status
sudo wg show
# Try disconnecting
sudo wg-quick down your-config-nameCheck for errors in the output.
All scripts follow strict bash practices. If you modify them, validate syntax:
bash -n ~/.config/waybar/scripts/vpn-status.sh
bash -n ~/.config/waybar/scripts/vpn-toggle.sh
bash -n ~/.config/waybar/scripts/vpn-select.shThe sudoers configuration allows running wg-quick without a password. This is limited to:
- Only the
/usr/bin/wg-quickbinary - Only for users in the
wheel/sudogroup
This is generally safe, but be aware that anyone with access to your user account can control VPN connections without additional authentication.
If this is a concern in your environment, you can skip the sudoers setup and enter your password each time you toggle the VPN.
WireGuard configuration files in /etc/wireguard/ typically contain private keys. Ensure they have proper permissions:
sudo chmod 600 /etc/wireguard/*.conf
sudo chown root:root /etc/wireguard/*.confTo remove the VPN toggle:
-
Remove the scripts:
rm -rf ~/.config/waybar/scripts -
Remove from Waybar config:
- Delete
"custom/vpn"frommodules-rightarray - Delete the
"custom/vpn"configuration block - (Or restore from timestamped backup:
~/.config/waybar/config.jsonc.backup.YYYYMMDD-HHMMSS)
- Delete
-
Remove from
~/.config/waybar/style.css:- Remove
#custom-vpn,from the line with#custom-omarchy - (Or restore from timestamped backup:
~/.config/waybar/style.css.backup.YYYYMMDD-HHMMSS)
- Remove
-
Remove sudoers rule:
sudo rm /etc/sudoers.d/wireguard-vpn-toggle
-
Restart Waybar:
killall waybar && waybar &
All bash scripts follow the Omarchy way - bash practices observed in the Omarchy repository:
- Shebang and strict mode:
#!/bin/bashwithset -eEo pipefail - Error handling:
trap catch_errors ERR INT TERM; trap exit_handler EXIT - Function definitions:
name() { ... }(nofunctionkeyword) - Use
localfor function-scoped variables [[ ... ]]for conditions- Quoted variable expansions:
"${VAR}" - Command availability:
command -v tool &>/dev/null - 2-space indentation
- UPPER_SNAKE_CASE for globals, lower_snake_case for locals
Validate syntax of all scripts:
bash -n install.sh
for script in scripts/*.sh; do bash -n "$script"; doneBased on the manual setup guide by @rulonder in Omarchy Discussion #1366.
This project was built with a little help from Cursor AI - a great way to enforce Omarchy bash practices, maintain code consistency, and write comprehensive documentation. 🤖
MIT License - See LICENSE file for details.
Contributions are welcome! Please feel free to:
- Report bugs by opening an issue
- Suggest features or improvements
- Submit pull requests
When contributing code, please follow the existing bash style guide.
- Omarchy - Configuration framework this is designed for
- Waybar - Highly customizable Wayland bar
- WireGuard - Fast, modern VPN protocol
- ProtonVPN - Privacy-focused VPN service
Enjoy your new VPN toggle! 🔒✨