fix vpn and add rofi toggle
This commit is contained in:
parent
43998b73d7
commit
ae06e0c8c2
3 changed files with 39 additions and 1 deletions
|
|
@ -35,6 +35,12 @@ get_brightness_external() {
|
|||
fi
|
||||
}
|
||||
get_power_profile() { powerprofilesctl get 2>/dev/null || echo "balanced"; }
|
||||
get_vpn_status() {
|
||||
if systemctl is-active wg-quick-wg-vpn &>/dev/null; then echo "vpn"
|
||||
elif systemctl is-active wg-quick-wg-services &>/dev/null; then echo "services"
|
||||
else echo "off"
|
||||
fi
|
||||
}
|
||||
|
||||
get_default_sink_id() {
|
||||
wpctl inspect @DEFAULT_AUDIO_SINK@ 2>/dev/null | head -1 | awk '{print $2}' | tr -d ','
|
||||
|
|
@ -85,6 +91,12 @@ show_main() {
|
|||
echo " Brightness"
|
||||
echo " WiFi"
|
||||
echo " Bluetooth"
|
||||
local vpn_status=$(get_vpn_status)
|
||||
case "$vpn_status" in
|
||||
services) echo " VPN: Services" ;;
|
||||
vpn) echo " VPN: Full + AdBlock" ;;
|
||||
*) echo " VPN: Off" ;;
|
||||
esac
|
||||
echo " Power Profile"
|
||||
echo " Power"
|
||||
}
|
||||
|
|
@ -177,6 +189,19 @@ handle_main() {
|
|||
case "$SELECTION" in
|
||||
*"Sound"*) show_sound ;;
|
||||
*"Brightness"*) show_brightness ;;
|
||||
*"VPN:"*)
|
||||
local vpn_status=$(get_vpn_status)
|
||||
case "$vpn_status" in
|
||||
off) busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss wg-quick-wg-services.service replace &>/dev/null ;;
|
||||
services)
|
||||
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StopUnit ss wg-quick-wg-services.service replace &>/dev/null
|
||||
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss wg-quick-wg-vpn.service replace &>/dev/null ;;
|
||||
vpn)
|
||||
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StopUnit ss wg-quick-wg-vpn.service replace &>/dev/null
|
||||
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss wg-quick-wg-services.service replace &>/dev/null ;;
|
||||
esac
|
||||
sleep 1
|
||||
show_main ;;
|
||||
*"WiFi"*) coproc (rofi-network-manager &); exit 0 ;;
|
||||
*"Bluetooth"*) coproc (rofi-bluetooth &); exit 0 ;;
|
||||
*"Power Profile"*) show_power_profile ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue