summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/rbar_wifi
diff options
context:
space:
mode:
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"