- Notifications
You must be signed in to change notification settings - Fork3
A Waybar extension to manage a Wireguard connection using Systemd and Rofi.
License
Klafyvel/wireguard-manager
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a simple, stupidwaybar extension for togglingwireguard. It usesrofi for password prompting, but you could use anything you like.
VPN switched off, as seen in Waybar.
VPN switched on, as seen in Waybar.
You need to be able to manage Wireguard using systemd, even though it shouldnot be too difficult to change the script to usewg directly.
If your Wireguard interface iswg0, enable the service using:
sudo systemctlenable wg-quick@wg0.servicesudo systemctl daemon-reloadYou also needrofi.
Clone the repository in~/.config/waybar/wireguard-manager, then add this to~/.config/waybar/config :
"custom/wireguard-manager": {"exec":"exec ~/.config/waybar/wireguard-manager/wireguard-manager.sh -s","format":"{icon}","format-icons": {"connected":"<span color=\"#50fa7b\">VPN: 🔒</span>","disconnected":"<span color=\"#ff5555\">VPN: 🔓</span>", },"interval":"once","on-click":"~/.config/waybar/wireguard-manager/wireguard-manager.sh -t && pkill -SIGRTMIN+1 waybar","return-type":"json","signal":1,}
SeeWaybar's wiki formore information on how to customize this.
If you intend on turning your Wireguard tunnel on and off through other means other than clicking on this waybar module, it can be useful to set the module itself in a different fashion:
"custom/wireguard-manager": {"interval":3,"return-type":"json","format-icons": {"connected":"<span color=\"#50fa7b\">VPN: 🔒</span>","disconnected":"<span color=\"#ff5555\">VPN: 🔓</span>" },"on-click":"exec ~/.config/waybar/wireguard-manager/wireguard-manager.sh -t","exec":"exec ~/.config/waybar/wireguard-manager/wireguard-manager.sh -s","format":"{icon}"}
This is because the version of the module presented first updates itself only when clicked on, to avoid constant polling of the status of the systemd service for Wireguard. If you do use other means to set your tunnel up or down (such assudo systemctl stop wg-quick@wg0.service), it is recommended to use this other version of the module, as it polls the current status of the systemd service every 3 seconds, updating the status of the module without requiring the user to click on it.
With the given configuration, the status of the connection will be updated every3 seconds. You can switch on/off the connection to your peer by clicking on theicon in Waybar.
This module is simple enough for anyone to customize it. You can change the waythe rofi prompt looks by editingrofi.rasi, or you can use any other way toprompt the password. You can also change the way things look in Waybar byediting the sample configuration.
Contributions are most welcome, feel free to submit any idea or improvement youcan think of.
If you are a NetworkManager user, maybe you should rather usewireguard-rofi-waybar, which seems to offerway more functionalities!
About
A Waybar extension to manage a Wireguard connection using Systemd and Rofi.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.
