Skip to content

Commit 0e568d1

Browse files
Merge pull request #346 from dracula/feat/vpn-prettify
improving the looks and docs of network-vpn
2 parents 3323120 + 15c3699 commit 0e568d1

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

docs/CONFIG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,17 @@ set -g @dracula-ping-rate 5
515515
```
516516

517517
### network-vpn - [up](#table-of-contents)
518-
This widget displays whether a vpn is connected.
518+
This widget tries to display whether a vpn is connected.
519+
Tailscale exit nodes are fully supported for Linux and MacOS.
519520

520-
These options are not available yet.
521+
Set verbose to true in order to see the VPNs IP or name of Tailscale exit node.
521522
```bash
522523
set -g @dracula-network-vpn-verbose true
523-
set -g @dracula-network-vpn-label
524+
```
525+
526+
Set the widgets label like so:
527+
```bash
528+
set -g @dracula-network-vpn-label "󰌘 "
524529
```
525530
### playerctl - [up](#table-of-contents)
526531
This widget displays playerctl info.

scripts/network_vpn.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ vpn_function() {
1313

1414
verbose=$(get_tmux_option "@dracula-network-vpn-verbose" false)
1515

16-
#Show IP of tun0 if connected
16+
# Show IP of tun0 if connected
1717
vpn=$(ip -o -4 addr show dev tun0 | awk '{print $4}' | cut -d/ -f1)
1818

1919
which -s tailscale > /dev/null
2020
tailscale_installed=$?
2121

2222
if [[ $vpn =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
23-
echo $vpn
23+
if $verbose; then
24+
vpn_label=$(get_tmux_option "@dracula-network-vpn-label" "󰌘 ")
25+
echo "$vpn_label$vpn"
26+
else
27+
vpn_label=$(get_tmux_option "@dracula-network-vpn-label" "VPN-ON")
28+
echo "$vpn_label"
29+
fi
2430
elif [ $tailscale_installed ]; then
2531
# if tailscale is installed
2632
#

0 commit comments

Comments
 (0)