Home

Awesome

Tmux-mullvad

Recent changes

Purpose

Monitoring Mullvad VPN status

Screenshots

All status icons, labels, spacing around them and colors can be altered in your config, these are just defaults, and some samples of my preferred style

DisplayDescription
disconnected_defaultDisconnected status has it's color, if you would prefer to have a strong indicator that VPN is not active.
disconnected_no_bgWhen I can't use VPN, like sometimes with Primevideo, it's enough for me to see the open padlock.<br> I find a bg color to be overly distracting.
connectingConnecting ...
blockedVPN Blocked. Most likely your device is not connected to the internet. Could also be the attempted VPN destination having issues.
connectedConnected has it's color, same as with disconnected, some might prefer to change or disable the bg color.
connected_silentBeing connected in my home country is the default, so then I don't need any notification.
connected_countryWhen connected in another country, it makes sense to see where the VPN is routed.
connected_cityIf you want more specifics, then add city.

Dependencies

Installation

Installation with Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin 'jaclu/tmux-mullvad'

Hit prefix + I to fetch the plugin and source it. That's it!

Manual Installation

Clone the repository:

git clone https://github.com/jaclu/tmux-mullvad ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/mullvad.tmux

Reload TMUX environment with $ tmux source-file ~/.tmux.conf, and that's it.

Usage

Add any of the supported format strings to status-left or status-right.

Supported Format Strings

CodeAction
#{mullvad_status}Displays connection status, defaults to a padlock icon
#{mullvad_country}Country used, only displayed when connected.
#{mullvad_city}City used, only displayed when connected.
#{mullvad_server}Server used, only displayed when connected.
#{mullvad_ip}Public IP# used, only displayed when connected.
#{mullvad_status_color}The fg,bg color pair matching the current status wrapped into a tmux status bar color directive. Usage example: #{mullvad_status_color}Something#[default] the above mullvad format strings already comes wrapped in color directives, so this would only be meaningful if you want to display something else that should be colored in accordance with mullvad status.

Variables that can be set

To disable a setting, set it to " ", spaces will be trimmed and thus nothing will end up being printed, if you set it to "" it will be ignored and the default value will be used.

VariableDefaultPurpose
@mullvad_cache_time5Since typically multiple checks of mullvad status are made for each update of the display, cashing this will greatly improve response times. You can disable all caching by setting this to 0.<br> Even if this matches your status interval, this will still make the check much faster, since only one actual status check is done.
@mullvad_disconnected_textopen padlock iconStatus
@mullvad_disconnected_fg_colorcolor
@mullvad_disconnected_bg_colorredcolor
@mullvad_blocked_textopen padlock iconStatus
@mullvad_blocked_fg_colorcolor
@mullvad_blocked_bg_colorpurplecolor
@mullvad_connecting_textclosed padlock iconStatus
@mullvad_connecting_fg_colorcoloe
@mullvad_connecting_bg_coloryellowcolor
@mullvad_connected_textclosed padlock icon with key on the sideStatus
@mullvad_connected_fg_colorcolor
@mullvad_connected_bg_colorgreencolor
@mullvad_status_prefix""Prefix for the status text
@mullvad_status_suffix""Suffix for the status text
@mullvad_status_no_color_prefix0Padding, see below
@mullvad_status_no_color_suffix0Padding, see below
@mullvad_excluded_country""If this is the connected country, do not display #{mullvad_country} or #{mullvad_status} (when connected)
@mullvad_country_prefix""Prefix for the country name, using color
@mullvad_country_suffix""Suffix for the country name, using color
@mullvad_country_no_color_prefix0Padding, see below
@mullvad_country_no_color_suffix0Padding, see below
@mullvad_excluded_city""If this is the connected city, do not display #{mullvad_city} (when connected)
@mullvad_city_prefix""Prefix for the city name
@mullvad_city_suffix""Suffix for the city name
@mullvad_city_no_color_prefix0Padding, see below
@mullvad_city_no_color_suffix0Padding, see below
@mullvad_server_prefix""Prefix for the server name
@mullvad_server_suffix""Suffix for the server name
@mullvad_server_no_color_prefix0Padding, see below
@mullvad_server_no_color_suffix0Padding, see below
@mullvad_ip_prefix""Prefix for the IP#
@mullvad_ip_suffix""Suffix for the IP#
@mullvad_ip_no_color_prefix0Padding, see below
@mullvad_ip_no_color_suffix0Padding, see below

Padding the elements

Unlike the _prefix and _suffix variables, that uses the status color, the _no_color_ variables controls if there should be a space char before or after the corresponding item without any color setting. Only used if the item is not empty and thus displayed. This helps keeping the Status Bar compact. Setting it to 1 will insert a space char.

You can see how I use it in the example config below.

Example config

set -g @plugin 'jaclu/tmux-mullvad'

#
#  I only want to be notified about where the VPN is connected if not
#  connected to my normal location, typically when avoiding Geo blocks.
#  Since this will negatively impact bandwith and lag, its good to have a
#  visual reminder.
#
set -g @mullvad_excluded_country 'Netherlands' # dont display this country
set -g @mullvad_excluded_city    'Amsterdam'   # dont display this city

#  No colors wanted for disconnected status, just distracting.
set -g @mullvad_disconnected_bg_color ' '

#  Since nothing is printed when connected, we don't need to bother with the colors
set -g @mullvad_connected_text ' '

#  When city/country is printed, use comma as separator
set -g @mullvad_city_suffix ', '

#
#  Keep separation if items are displayed
#
set -g @mullvad_country_no_color_suffix 1
set -g @mullvad_status_no_color_suffix 1

#
#  What I use in status bar to display this status.
#  Since no_color padding is used if something is displayed, there is no need
#  to waste space in the status bar for separation that will just end up being
#  a double space when nothing is displayed.
#
#    other stuff before#{mullvad_city}#{mullvad_country}#{mullvad_status}other stuff after...

Status Update Interval

Status update won't be instant. The lag depends on the status-interval Tmux option. You can set it to a low number to make the refresh faster.

set -g status-interval 5

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

The best way to send feedback is to file an issue at issues for this repo.

License

MIT