more waybar

This commit is contained in:
Barrett Ruth 2026-02-14 18:00:05 -05:00
parent 496d4ff7f0
commit ed6497419f
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 14 additions and 3 deletions

View file

@ -151,7 +151,7 @@ in
tooltip-format-wifi = "SSID: {essid}\nDown: {bandwidthDownBits}\nUp: {bandwidthUpBits}\nIP: {ipaddr}"; tooltip-format-wifi = "SSID: {essid}\nDown: {bandwidthDownBits}\nUp: {bandwidthUpBits}\nIP: {ipaddr}";
tooltip-format-ethernet = "{ifname} · {ipaddr}"; tooltip-format-ethernet = "{ifname} · {ipaddr}";
tooltip-format-disconnected = "disconnected"; tooltip-format-disconnected = "disconnected";
on-click = "rfkill toggle wifi"; on-click = "ctl wifi toggle";
on-click-right = "ctl wifi pick"; on-click-right = "ctl wifi pick";
}; };

View file

@ -159,6 +159,16 @@ volume)
;; ;;
wifi) wifi)
case "$2" in case "$2" in
toggle)
require notify-send
rfkill toggle wifi
sleep 0.5
if rfkill list wifi | grep -q 'Soft blocked: yes'; then
notify-send -a ctl -t 2500 -r 5557 "󰖪 wifi disconnected"
else
notify-send -a ctl -t 2500 -r 5557 "󰖩 wifi connected"
fi
;;
pick) pick)
require fuzzel require fuzzel
station=$(iwctl device list 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | awk '/station/{print $1}') station=$(iwctl device list 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | awk '/station/{print $1}')
@ -173,12 +183,13 @@ wifi)
sed 's/[[:space:]]*$//' | \ sed 's/[[:space:]]*$//' | \
grep -v '^-') grep -v '^-')
[ -z "$networks" ] && exit 0 [ -z "$networks" ] && exit 0
ssid=$(printf '%s\n' "$networks" | fuzzel --dmenu --prompt="wifi: " --no-icons) count=$(printf '%s\n' "$networks" | wc -l)
ssid=$(printf '%s\n' "$networks" | fuzzel --dmenu --prompt="wifi: " --no-icons --lines="$count")
[ -z "$ssid" ] && exit 0 [ -z "$ssid" ] && exit 0
iwctl station "$station" connect "$ssid" iwctl station "$station" connect "$ssid"
;; ;;
*) *)
echo "Usage: ctl wifi {pick}" >&2 echo "Usage: ctl wifi {toggle|pick}" >&2
exit 1 exit 1
;; ;;
esac esac