Manage your VPN via this module. The vpn_module
reports the VPN's status in one of three states: [<location> | Connecting... | No VPN ]
, where the location is your
The polybar_module_definition
file can be appended to your polybar module definitions, adding the vpn
module with these preset capabilities:
2022-09-24 Reimplemented favorite VPN location arrays.
./mullvad/update_mullvad_relays
script, and look for the user favorite arrays.2022-09-23 Overhauled the package...
vpn_module.sh
to the more modern vpn_module
. Several command calls have changed. See the usage section below or run vpn_module help
. You can probably just re-clone the package and re-copy the new polybar_module_definition
. The previous version is left under the branch old-master
.update_mullvad_relays
script.vpn_module help
or the script with no parameters.polybar-vpn-controller is scripted to facilitate differing VPN's, but compatibility will depend on your VPN's API. The stock settings are intended for use with Mullvad VPN. See the vpn_module
script user settings to judge whether this code can easily be adapted for your choice of VPN. It'd be great to make this module more robust for other VPN's, so please contribute other setups. Thanks!
You need a VPN!
mullvad-vpn
, available for Arch-baseds systems in the AURvpn_module
)rofi
, while not strictly necessary, is probably going to be wanted by the majority of users.geoip
and geoip-database
- provide country info instead of public IP addressgeoip-database-extra
- also provides city infoxclip
- allows copying ip address to clipboardThe optional dependencies can be found in the Arch Package Repository.
This setup assumes that you use Mullvad, that your polybar
configuration is at ~/.config/polybar
, and that you are importing module definitions from user_modules.ini
. (To setup a VPN other than Mullvad, read the configuration tips in vpn_module
. Modify as necessary. Also change the status reporting method in vpn_module
to either geoip
or some other method. )
cd ~/.config/polybar
git clone https://github.com/shervinsahba/polybar-vpn-controller.git
cd polybar-vpn-controller
./mullvad/update_mullvad_relays
cat polybar_module_definition >> ~/.config/polybar/user_modules.ini
Now add the vpn
module to your polybar's config
or config.ini
.
Run vpn_module help
.
Usage: vpn_module <option>
options:
toggle toggles VPN connection
menu opens rofi menu to select VPN location
ip-clip copies ip address to clipboard
status <method> reports back with VPN status and location
methods:
mullvad uses mullvad status to print location
other-vpn uses a generic method to print location
geoip uses the geoip package to print location
ip prints ip address
The Mullvad VPN client may create excessive entries in the system journal because of the way this script calls on it. To suppress these messages in your log, follow these instructions for a distro with systemd
. Tested on Manjaro and Arch.