add vpn script
This commit is contained in:
parent
1a97de00a9
commit
2a37cdd6da
4
home/darwin/sketchybar/items/vpn.sh
Normal file
4
home/darwin/sketchybar/items/vpn.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
sketchybar -m --add item vpn right \
|
||||
--set vpn icon= \
|
||||
update_freq=5 \
|
||||
script="~/.config/sketchybar/plugins/vpn.sh"
|
16
home/darwin/sketchybar/plugins/vpn.sh
Normal file
16
home/darwin/sketchybar/plugins/vpn.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
### You need to edit sudoers file to run wg-quick without password
|
||||
|
||||
# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick
|
||||
|
||||
WG_PIDFILE="/var/run/wireguard/wg0.name"
|
||||
|
||||
if [ -f $WG_PIDFILE ]; then
|
||||
sketchybar -m --set vpn icon= \
|
||||
label="$VPN" \
|
||||
drawing=on \
|
||||
click_script="~/.config/sketchybar/plugins/wg_off.sh"
|
||||
else
|
||||
sketchybar -m --set vpn drawing=off click_script="~/.config/sketchybar/plugins/wg_on.sh"
|
||||
fi
|
5
home/darwin/sketchybar/plugins/wg_off.sh
Normal file
5
home/darwin/sketchybar/plugins/wg_off.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
### You need to edit sudoers file to run wg-quick without password
|
||||
|
||||
# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick
|
||||
|
||||
sudo wg-quick down wg0
|
5
home/darwin/sketchybar/plugins/wg_on.sh
Normal file
5
home/darwin/sketchybar/plugins/wg_on.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
### You need to edit sudoers file to run wg-quick without password
|
||||
|
||||
# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick
|
||||
|
||||
sudo wg-quick up wg0
|
|
@ -29,6 +29,7 @@
|
|||
# "slack"
|
||||
# "zoom"
|
||||
# "firefox"
|
||||
# "1password-cli"
|
||||
|
||||
# Utility Tools
|
||||
# "syncthing"
|
||||
|
|
|
@ -48,6 +48,7 @@ source "$ITEM_DIR/calendar.sh"
|
|||
source "$ITEM_DIR/battery.sh"
|
||||
source "$ITEM_DIR/volume.sh"
|
||||
source "$ITEM_DIR/cpu.sh"
|
||||
source "$ITEM_DIR/vpn.sh"
|
||||
|
||||
#################### Finalizing Setup ####################
|
||||
|
||||
|
|
Loading…
Reference in a new issue