A simple and sleek Waybar module for Tailscale that shows your current status, toggles on click and allows for quick and easy login when needed
![]()
This module uses the tailscale cli commands to enable, disable and get the status of aspects of the tailnet. A custom icon is implemented via css and icon images stored in the icons sub directory.
By default the module has text enabled and will display whether you are Connected, Disconnected or Logged Out*.
It is also possible to disable the text and just have the logo, but then you only get the connected and disconnected indicators. (Except for the tooltip)
Depending on your status the tooltip will display different information.
The Tailnet IP will be shown
The current status is shown
A prompt informing the user to 'Click to Login' is shown (This only works if the tailscale set --operator is set, how to permentatnyl enable this is shown in the Configuration section below).
Really there is only one type of interaction, left click. When a user is logged into Tailscale and clicks on the module their connection state will be toggled, if the user is logged out a browser window will be opened to perform the authentication. Once authentication is complete the module will automatically update to Connected.
The click to login function only works if tailscale set --operator=$USER is set or tailscale is configured to not need it, this is explain in the Configuration section below.
Optional
- A notifier agent
First ensure that you have all of the dependencies.
Next, to install the module either clone or download the repo to $HOME/.config/waybar/tailscale. You can also set the tailscale operator which will remove the sudo requirement.
sudo tailscale set --operator=$USERThis will need to be done each time you are logged out of tailscale, there is a way to avoid needing to do this and it is explained in the configuration section
There are a few different areas which need to be configured all dependent how you want the module to function
To enable the module to login on click Tailscale must be given the ability to run without sudo. This can be done by running
sudo tailscale set --operator=$USERBut this needs to be run EACH time the user is logged out. The module will not crash if this is not set but it will not complete the login. The user will be notified that the operation cannot be completed and the value can either be set and then the login attempted again or the login can be done manually.
The other option is to allow tailscale to execute sudo commands without a password. This can lower your overall system security but this is left up to your own discretion. To do this you need to edit /etc/sudoers. First ensure that you either have vi installed or you have a text editor (vim, nvim, nano) set (export EDITOR=vim).
Find where Tailscale is installed with
which tailscaleIt is often installed at /usr/bin/tailscale
Next run sudo visudo to open the sudoers file. This can really be put anywhere but to keep things consistent find the 'User priviledge specification' section. Now enter a new rule
<your-user-name> ALL=(ALL) NOPASSWD: /usr/bin/tailscaleand save the file. Now when you click on the tailscale module to login, the current user will be set to the operator (if it is not already set).
The application comes with its own configuration file called config.json located at $HOME/.config/waybar/tailscale/config.json. The location can be altered by changing the config_file variable in tailscale.sh.
| key | Function |
|---|---|
tailscale-up-flags |
This is a list of flags which will be used when a tailscale connection is made. By default the flag --accept-routes is set (just because this is something I need) |
display-status-text |
This is boolean, if true Connected, Disconnected and Logged Out will be displayed alongside the logo |
Finally the module needs to be added to the Waybar config.jsonc file. There is an example configuration provided in waybar-config-example.jsonc but it will also be shown below.
Edit the waybar/config.jsonc file and add the following to the bottom as a custom module
ensure it is named custom/tailscale as this is what the custom css looks for.
The 'restart-interval` can be increased but it will of course cause there to be a delay when updating.
Now insert the module on the bar
"modules-right": [
"custom/tailscale"
]