Giter Site home page Giter Site logo

tailscale-polybar-rofi's Introduction

Polybar Module and Rofi dmenu for tailscale

  • display tailscale VPN connection status in polybar
  • enable/disable tailscale from rofi
    • automatically shows one option per available exit node

Polybar module and Rofi dmenu for tailscale

Setup

Polybar Module

  1. Put info-tailscale.sh somewhere on your system, for example to ~/.config/polybar/info-tailscale.sh.
  2. In your polybar config, add:
    [module/info-tailscale]
    type = custom/script
    exec = ~/.config/polybar/info-tailscale.sh
    interval = 10
    
    Also add info-tailscale to modules-left, modules-center, or modules-right.

(The demo GIF uses interval = 3 for added effect.)

Rofi Switcher

  1. Put choose_vpn_config.sh somewhere on your system, for example ~/.config/scripts/choose_vpn_config.sh.
  2. Add a keybinding in your window manager that triggers the script. Example config snippet for i3wm:
    bindsym $mod+Shift+v exec --no-startup-id $HOME/.config/scripts/choose_vpn_config.sh
    
  3. Run sudo tailscale up --operator $(whoami) once. This gives your username permission to tailscale up without sudo in the future (i.e. when using the rofi switcher).

Alternative with polkit

Support for the --operator option wasn't unanimous when it was introduced. In case it is removed again in the future, polkit can be used as an alternative for rights elevation:

  1. Install polkit and a polkit authentication agent.
    • for example sudo apt install lxpolkit on Debian-based OS
  2. Run the agent on session startup.
    • for example exec --no-startup-id lxpolkit when using i3wm
  3. Remove the --operator options in choose_vpn_config.sh, and use pkexec for the tailscale invocation.

Font (optional)

For the door icons, I use fontawesome.

Alternatives and Credits

Related Projects (not for tailscale)

tailscale-polybar-rofi's People

Contributors

mbugert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tailscale-polybar-rofi's Issues

Script stops working due to changes in localapi

Since one of the last updates of tailscale the script stopped working.
If I call the local api manually (with the command from the script) I get the following error:

curl --silent --fail --unix-socket /run/tailscale/tailscaled.sock http://tailscale/localapi/v0/status
curl: (22) The requested URL returned error: 403

According to tailscale/tailscale#6446 the command has to be changed into:

curl --silent --fail --unix-socket /var/run/tailscale/tailscaled.sock http://local-tailscaled.sock/localapi/v0/status

That worked for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.