Home

Awesome

polybar-wireguard

demo

A simple Polybar script to display and control WireGuard VPNs.

Dependencies

Installation

  1. wg-quick binary needs sudo access to run which isn't great news for scripting. I have therefore added a specific rule to my /etc/sudoers (via visudo) to make them password-less:
INSERT_YOUR_USERNAME ALL = (root) NOPASSWD: /usr/bin/wg-quick

⚠️ You obviously don't want to do this for a user who doesn't already have sudo access! WireGuard let's you to add hooks for various events which could let a non-sudo user run arbitrary code.

  1. Edit the configs_path variable in the script to point it to where your WireGuard configs live. If they're in /etc/wireguard you might have to make sure permissions of that directory allows listing the files inside it. I believe by default that directory is only accessible by root.

  2. If you're keeping the default icon from Material font, make sure the font is configured correctly in Polybar and the script. Note that the Polybar font indexing is off by 1. The unmodified script expects the following in the Polybar:

font-3 = Material Icons:style=Regular:size=15
  1. Add a module to Polybar. For example:
[module/wireguard]
type = custom/script
exec = /PATH/TO/wireguard_polybar
tail = false
interval = 1
click-left = /PATH/TO/wireguard_polybar --toggle &