#!/bin/bash signal=30 # signal dwmblocks to update network block send_signal() { pkill -RTMIN+$signal dwmblocks } toggle_wifi() { status=$(nmcli radio wifi) if [ "$status" = "enabled" ]; then nmcli radio wifi off else nmcli radio wifi on fi } # This one is hard because it requires root, and the VPN interface name # 2 ways to toggle, using systemctl, or wg-quick(1) # This one might be better controled through a `dmenu` script. toggle_vpn() { : } toggle_network_quarantine() { # Check the status of all wireless devices if rfkill list | grep -q "Soft blocked: no"; then # not all blocked rfkill block all else # all blocked rfkill unblock all fi } # WIP toggle_bluetooth() { : } case $1 in wifitoggle) toggle_wifi ;; vpntoggle) toggle_vpn ;; bluetoothtoggle) toggle_bluetooth ;; isolatetoggle) toggle_network_quarantine ;; *) echo "invalid option :)" ;; esac send_signal