summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/rbar_wifi
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2015-02-06 15:17:51 -0500
committerLuke Shumaker <shumakl@purdue.edu>2015-02-06 15:17:51 -0500
commitdab097d5000c4697761b6985cb3512f7bce0147f (patch)
tree7b81b7826a1e23822955560f0f73dc09cda6c8e8 /.config/wmii-hg/rbar_wifi
parentf50b49ef26f5c692bda1f3f13cd38f9f4f395300 (diff)
parenta6f973687fb4a1a4558f74f7da595b6902a5dce0 (diff)
Merge remote-tracking branch 'origin/master' into purdue-cs/master
Conflicts: .config/X11/clientrc .config/bash/rc.d/emacs.sh .config/cron/make-config .config/emacs/custom.el .config/emacs/init.el .config/git/config .config/login.sh .config/selected_editor .local/bin/config-path
Diffstat (limited to '.config/wmii-hg/rbar_wifi')
-rwxr-xr-x.config/wmii-hg/rbar_wifi68
1 files changed, 62 insertions, 6 deletions
diff --git a/.config/wmii-hg/rbar_wifi b/.config/wmii-hg/rbar_wifi
index 18395a3..195df7c 100755
--- a/.config/wmii-hg/rbar_wifi
+++ b/.config/wmii-hg/rbar_wifi
@@ -1,9 +1,65 @@
#!/bin/bash
-. include.sh
-priority=$1
+iwinfo() {
+ local interface=$1
+ iwconfig "$interface" |
+ sed -r 's/ {2,}/\n/g' |
+ sed -e '/^\s*$/d' -e 's/:\s*/=/' \
+ -e '1s/^/Interface=/' \
+ -e '2s/^/MAC Protocol=/'
+}
-while connected_to_x_server; do
- echo 'label Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) >> "$WMII_DIR/rbar/${priority}_wifi"
- 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; printf '> %s\n' 'New Network' 'Disable All' 'Enable All';} | sed 's,$,$,' | column -s '$' -t)
+
+ cur=''
+ for item in "${list[@]}"; do
+ if [[ "$item" = '* '* ]]; then
+ cur="$item"
+ fi
+ done
+
+ item=$(wmii9menu -i "$cur" "${list[@]}")
+ case "$item" in
+ '')
+ # Nothing selected
+ ;;
+ '* '*)
+ # Already selected; do nothing
+ ;;
+ '> New Network'*)
+ urxvt +sb -title wifi-menu -e sudo wifi-menu
+ ;;
+ '> Disable All'*)
+ sudo netctl-auto disable-all
+ ;;
+ '> Enable All'*)
+ sudo netctl-auto enable-all
+ ;;
+ *)
+ # NB: do NOT quote $item; we need to strip whitespace
+ sudo netctl-auto switch-to $item
+ ;;
+ esac
+}
+
+. "$(dirname "$0")/rbar.sh"