summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/rbar_wifi
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-01-29 00:53:11 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-01-29 00:53:11 -0500
commitfd40e4ddaefc70acb2cedcbe69bce49077a62376 (patch)
tree76849ca041f6ad48e9ffa050b605e6d2fd0d6d5e /.config/wmii-hg/rbar_wifi
parent8761e30b770ae0995dac884a04f2ac3818bcfc26 (diff)
wmii: Make rbar way cooler
Diffstat (limited to '.config/wmii-hg/rbar_wifi')
-rwxr-xr-x.config/wmii-hg/rbar_wifi49
1 files changed, 37 insertions, 12 deletions
diff --git a/.config/wmii-hg/rbar_wifi b/.config/wmii-hg/rbar_wifi
index 53464dc..63dc653 100755
--- a/.config/wmii-hg/rbar_wifi
+++ b/.config/wmii-hg/rbar_wifi
@@ -1,11 +1,7 @@
#!/bin/bash
-. include.sh
-
-id=$1
-trap "rm -f ${WMII_DIR}/rbar/${id}" EXIT
iwinfo() {
- interface=$1
+ local interface=$1
iwconfig "$interface" |
sed -r 's/ {2,}/\n/g' |
sed -e '/^\s*$/d' -e 's/:\s*/=/' \
@@ -13,10 +9,39 @@ iwinfo() {
-e '2s/^/MAC Protocol=/'
}
-while connected_to_x_server; do
- {
- printf 'label '
- iwinfo wlp2s0|grep -E '^(ESSID|Link Quality)='|sed 'N;s/\n/ | /'
- } | sponge >> "${WMII_DIR}/rbar/${id}"
- sleep 1
-done
+update() {
+ local id
+ id=$1
+ setup_trap "$id"
+ while true; do
+ {
+ printf 'label '
+ iwinfo wlp2s0|grep -E '^(ESSID|Link Quality)='|sed 'N;s/\n/ | /'
+ } | write "$id"
+ sleep 1
+ done
+}
+
+right-click() {
+ local list cur item
+
+ list=()
+ IFS=''
+ while read -r line; do
+ list+=("$line")
+ done < <(netctl-auto list | sed 's,$,$,' | column -s '$' -t)
+
+ cur=''
+ for item in "${list[@]}"; do
+ if [[ "$item" = '* '* ]]; then
+ cur="$item"
+ fi
+ done
+
+ item=$(wmii9menu -i "$cur" "${list[@]}")
+ if [[ -n $item ]] && [[ "$item" != '* '* ]]; then
+ netctl-auto switch-to "$item"
+ fi
+}
+
+. "$(dirname "$0")/rbar.sh"