summaryrefslogtreecommitdiff
path: root/.config/wmii-hg
diff options
context:
space:
mode:
Diffstat (limited to '.config/wmii-hg')
-rw-r--r--.config/wmii-hg/rbar.sh7
-rwxr-xr-x.config/wmii-hg/rbar_wifi31
2 files changed, 28 insertions, 10 deletions
diff --git a/.config/wmii-hg/rbar.sh b/.config/wmii-hg/rbar.sh
index b02c2e9..4180444 100644
--- a/.config/wmii-hg/rbar.sh
+++ b/.config/wmii-hg/rbar.sh
@@ -13,6 +13,13 @@ write() {
sponge|tee -a "${dirs[@]/%/${1}}" > /dev/null || true
}
+type left-click &>/dev/null || left-click() { :; }
+type middle-click &>/dev/null || middle-click() { :; }
+type right-click &>/dev/null || right-click() { :; }
+type scroll-up &>/dev/null || scroll-up() { :; }
+type scroll-down &>/dev/null || scroll-down() { :; }
+type update &>/dev/null || update() { :; }
+
set -eE
shopt -s nullglob
case "$1" in
diff --git a/.config/wmii-hg/rbar_wifi b/.config/wmii-hg/rbar_wifi
index c77efa5..48ea06c 100755
--- a/.config/wmii-hg/rbar_wifi
+++ b/.config/wmii-hg/rbar_wifi
@@ -53,20 +53,31 @@ update() {
}
right-click() {
- local list cur item
+ local list
+ mapfile -t list < <({ netctl-auto list | sort -k1.2; printf '> %s\n' 'New Network' 'Disable All' 'Enable All';} | sed 's,$,$,' | column -s '$' -t)
- list=()
- IFS=''
- while read -r line; do
- list+=("$line")
- done < <({ netctl-auto list | sort -k1.2; printf '> %s\n' 'New Network' 'Disable All' 'Enable All';} | sed 's,$,$,' | column -s '$' -t)
-
- cur=''
+ local cur=''
+ local any_enabled=false
+ local item_enable_all=''
+ local item_new_network=''
+ local item
for item in "${list[@]}"; do
- if [[ "$item" = '* '* ]]; then
- cur="$item"
+ case "$item" in
+ '* '*) cur="$item";;
+ '> New Network'*) item_new_network=$item;;
+ '> Enable All'*) item_enable_all=$item;;
+ esac
+ if [[ "$item" != '! '* ]] && [[ "$item" != '> '* ]]; then
+ any_enabled=true
fi
done
+ if [[ -z $cur ]]; then
+ if $any_enabled; then
+ cur=$item_new_network
+ else
+ cur=$item_enable_all
+ fi
+ fi
IFS=$' \t\n'
item=$(wmii9menu -i "$cur" "${list[@]}")