vpn button waybar
This commit is contained in:
3
.config/waybar/scripts/askpass.sh
Normal file
3
.config/waybar/scripts/askpass.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
rofi -dmenu -password -no-fixed-num-lines -p "Sudo password"
|
12
.config/waybar/scripts/wireguard-status.sh
Executable file
12
.config/waybar/scripts/wireguard-status.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVICE_NAME="wg-quick@wg0"
|
||||
STATUS_CONNECTED_STR='{"text":"", "tooltip":"Tunnel connected."}'
|
||||
STATUS_DISCONNECTED_STR='{"text":"", "tooltip":"Tunnel disconnected"}'
|
||||
|
||||
function status_wireguard() {
|
||||
systemctl is-active $SERVICE_NAME >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
status_wireguard && echo $STATUS_CONNECTED_STR || echo $STATUS_DISCONNECTED_STR
|
16
.config/waybar/scripts/wireguard-toggle.sh
Executable file
16
.config/waybar/scripts/wireguard-toggle.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVICE_NAME="wg-quick@wg0"
|
||||
|
||||
function status_wireguard() {
|
||||
systemctl is-active $SERVICE_NAME >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
function askpass() {
|
||||
rofi -dmenu -password -no-fixed-num-lines -p "Sudo password"
|
||||
}
|
||||
|
||||
status_wireguard && \
|
||||
SUDO_ASKPASS=~/.config/waybar/scripts/askpass.sh sudo -A systemctl stop $SERVICE_NAME || \
|
||||
SUDO_ASKPASS=~/.config/waybar/scripts/askpass.sh sudo -A systemctl start $SERVICE_NAME
|
Reference in New Issue
Block a user