From f5f19ca8e8d46ba1087f8531e2309ac392c24112 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 14:33:31 -0400 Subject: wmii: phase out wmiir --- .wmii/include.sh | 37 ++++++++++++------------ .wmii/quit | 2 +- .wmii/rbar_battery | 2 +- .wmii/rbar_clock | 2 +- .wmii/rbar_cpu | 4 +-- .wmii/rbar_wifi | 2 +- .wmii/wmiirc | 84 +++++++++++++++++++++++------------------------------- 7 files changed, 61 insertions(+), 72 deletions(-) diff --git a/.wmii/include.sh b/.wmii/include.sh index 29d4d67..b1ec901 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -7,20 +7,22 @@ if [ -z "$WMII_DIR" ]; then export WMII_DIR="$HOME/n/wmii" fi -# a -- a work-around for buggy IO append in 9pfuse -# useing '|a' should be just like using '>>', but will work -# when 9pfuse decides to bug out. -a() { - f="${1/#${WMII_DIR}/}" - if [ "$f" = "$1" ]; then - cat >> "$1" - else - if wmiir ls "$f" &>/dev/null; then - wmiir write "$f" - else - wmiir create "$f" - fi - fi +# Linux's 9p kernel module sometimes omits entries in directory listings +unalias ls 2>/dev/null +ls() { + real_ls="`which ls` -1F" + [ $# = 0 ] && set -- "`pwd`" + case $# in + 1) + f="${1/#${WMII_DIR}/}" + if [ "$f" = "$1" ]; then + $real_ls "$f" + else + wmiir ls "$f" + fi + ;; + *) $real_ls "$f";; + esac } # I like wmiir's setsid better than linux-utils' @@ -37,9 +39,8 @@ path_which() { PATH="$mypath" "$which" -- "$prog" 2>/dev/null } - lstags() { - ls $WMII_DIR/tag | sed '/^sel$/d' + ls $WMII_DIR/tag | sed -e 's@/@@' -e '/^sel$/d' } scansection() { @@ -70,6 +71,6 @@ Action() { } connected_to_x_server() { - xdpyinfo &>/dev/null - return $? + xdpyinfo &>/dev/null + return $? } diff --git a/.wmii/quit b/.wmii/quit index 54f64e7..876a60e 100755 --- a/.wmii/quit +++ b/.wmii/quit @@ -1,3 +1,3 @@ #!/bin/bash . "$HOME/.wmii/include.sh" -echo quit |a $WMII_DIR/ctl +echo quit >> $WMII_DIR/ctl diff --git a/.wmii/rbar_battery b/.wmii/rbar_battery index 0e70799..ae8980a 100755 --- a/.wmii/rbar_battery +++ b/.wmii/rbar_battery @@ -4,6 +4,6 @@ priority=$1 while connected_to_x_server; do - acpi -b |a "$WMII_DIR/rbar/${priority}_battery" + acpi -b >> "$WMII_DIR/rbar/${priority}_battery" sleep 1 done diff --git a/.wmii/rbar_clock b/.wmii/rbar_clock index 86bf14d..18c4493 100755 --- a/.wmii/rbar_clock +++ b/.wmii/rbar_clock @@ -4,6 +4,6 @@ priority=$1 while connected_to_x_server; do - date |a "$WMII_DIR/rbar/${priority}_clock" + date >> "$WMII_DIR/rbar/${priority}_clock" sleep .5 done diff --git a/.wmii/rbar_cpu b/.wmii/rbar_cpu index d3bdd88..22da985 100755 --- a/.wmii/rbar_cpu +++ b/.wmii/rbar_cpu @@ -5,8 +5,8 @@ priority=$1 while connected_to_x_server; do # This doesn't work for me, it shows capacity - #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') |a "$WMII_DIR/rbar/${priority}_cpu" + #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') >> "$WMII_DIR/rbar/${priority}_cpu" # This actually displays %idle - echo 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]' |a "$WMII_DIR/rbar/${priority}_cpu" + echo 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]' >> "$WMII_DIR/rbar/${priority}_cpu" sleep 1 done diff --git a/.wmii/rbar_wifi b/.wmii/rbar_wifi index 2ea84a3..2ada834 100755 --- a/.wmii/rbar_wifi +++ b/.wmii/rbar_wifi @@ -4,6 +4,6 @@ priority=$1 while connected_to_x_server; do - echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) |a "$WMII_DIR/rbar/${priority}_wifi" + echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) >> "$WMII_DIR/rbar/${priority}_wifi" sleep 1 done diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 8d77394..1e88128 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -84,9 +84,9 @@ Event() { { case `wmii9menu Delete Fullscreen` in Delete) - echo kill |a $WMII_DIR/client/$client/ctl;; + echo kill >> $WMII_DIR/client/$client/ctl;; Fullscreen) - echo Fullscreen on |a $WMII_DIR/client/$1/ctl;; + echo Fullscreen on >> $WMII_DIR/client/$1/ctl;; esac }& ;; esac;; @@ -101,7 +101,7 @@ Event() { resp=$(wihack -transient $client \ xmessage -nearmouse -buttons Kill,Wait -print "$msg") if [ "$resp" = Kill ]; then - echo slay |a $WMII_DIR/client/$client/ctl + echo slay >> $WMII_DIR/client/$client/ctl fi }& ;; Fullscreen) ## $1=client $2=[on|off] @@ -110,24 +110,24 @@ Event() { ## Tag events CreateTag) ## $1=tag - echo "$WMII_NORMCOLORS" $@ |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;; DestroyTag) ## $1=tag rm $WMII_DIR/lbar/$1;; FocusTag) ## $1=tag - echo "$WMII_FOCUSCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;; UnfocusTag) ## $1=tag - echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; UrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_URGENTCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;; NotUrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; ## LeftBar events (usually tag buttons) LeftBarMouseDown) ## $1=button $2=bar_item ;; LeftBarClick) ## $1=button $2=bar_item shift # ignore the button - echo view "$@" |a $WMII_DIR/ctl;; + echo view "$@" >> $WMII_DIR/ctl;; LeftMouseDND) ## $1=button $2=bar_item Event LeftBarClick "$@";; @@ -152,50 +152,49 @@ Key() { ## Moving around $MODKEY-$LEFT) ## Select the client to the left - echo select left |a $WMII_DIR/tag/sel/ctl;; + echo select left >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$RIGHT) ## Select the client to the right - echo select right |a $WMII_DIR/tag/sel/ctl;; + echo select right >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$UP) ## Select the client above - echo select up |a $WMII_DIR/tag/sel/ctl;; + echo select up >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$DOWN) ## Select the client below - echo select down |a $WMII_DIR/tag/sel/ctl;; + echo select down >> $WMII_DIR/tag/sel/ctl;; $MODKEY-space) ## Toggle between floating and managed layers - echo select toggle |a $WMII_DIR/tag/sel/ctl;; + echo select toggle >> $WMII_DIR/tag/sel/ctl;; ## Moving clients around $MODKEY-Shift-$LEFT) ## Move selected client to the left - wmiir xwrite /tag/sel/ctl send sel left;; + echo send sel left >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$RIGHT) ## Move selected client to the right - wmiir xwrite /tag/sel/ctl send sel right;; + echo send sel right >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$UP) ## Move selected client up - wmiir xwrite /tag/sel/ctl send sel up;; + echo send sel up >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$DOWN) ## Move selected client down - wmiir xwrite /tag/sel/ctl send sel down;; - + echo send sel down >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers - wmiir xwrite /tag/sel/ctl send sel toggle;; + echo send sel toggle >> $WMII_DIR/tag/sel/ctl;; ## Moving through stacks $MODKEY-Control-$UP) ## Select the stack above - wmiir xwrite /tag/sel/ctl select up stack;; - $MODKEY-Control-$DOWN) # Select the stack below - wmiir xwrite /tag/sel/ctl select down stack;; + echo select up stack >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Control-$DOWN) ## Select the stack below + echo select down stack >> $WMII_DIR/tag/sel/ctl;; ## Client actions $MODKEY-shift-1) ## Toggle selected client's fullsceen state - wmiir xwrite /client/sel/ctl Fullscreen toggle;; + echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;; $MODKEY-shift-0) ## Close client - wmiir xwrite /client/sel/ctl kill;; + echo kill >> $WMII_DIR/client/sel/ctl;; ## Changing column modes $MODKEY-d) ## Set column to default mode - wmiir xwrite /tag/sel/ctl colmode sel default-max;; + echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;; $MODKEY-s) ## Set column to stack mode - wmiir xwrite /tag/sel/ctl colmode sel stack-max;; + echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;; $MODKEY-m) ## Set column to max mode - wmiir xwrite /tag/sel/ctl colmode sel stack+max;; + echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;; ## Running programs $MODKEY-a) ## Open wmii actions menu @@ -205,44 +204,33 @@ Key() { $MODKEY-Return) ## Launch a terminal setsid x-terminal-emulator & ;; - ## Other - $MODKEY-Control-t) ## Toggle all other key bindings - case $(wmiir read /keys | wc -l | tr -d ' \t\n') in - 0|1) - echo -n "$Keys" | wmiir write /keys - wmiir xwrite /ctl grabmod $MODKEY;; - *) - wmiir xwrite /keys $MODKEY-Control-t - wmiir xwrite /ctl grabmod Mod3;; - esac;; - ## Tag actions $MODKEY-t) ## Change to another tag { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /ctl view $tag + echo view $tag >> $WMII_DIR/ctl }& ;; $MODKEY-Shift-t) ## Retag the selected client sel=$(sed 1q $WMII_DIR/client/sel/ctl) { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /client/$sel/tags "$tag" + echo "$tag" >> $WMII_DIR/client/$sel/tags }& ;; esac } ## End Key # WM Configuration -echo font xft:Monospace-8 |a $WMII_DIR/ctl -echo focuscolors $WMII_FOCUSCOLORS |a $WMII_DIR/ctl -echo normcolors $WMII_NORMCOLORS |a $WMII_DIR/ctl -echo grabmod $MODKEY |a $WMII_DIR/ctl -echo border 1 |a $WMII_DIR/ctl +echo font xft:Monospace-8 >> $WMII_DIR/ctl +echo focuscolors $WMII_FOCUSCOLORS >> $WMII_DIR/ctl +echo normcolors $WMII_NORMCOLORS >> $WMII_DIR/ctl +echo grabmod $MODKEY >> $WMII_DIR/ctl +echo border 1 >> $WMII_DIR/ctl xsetroot -solid "$WMII_BACKGROUND" & progsfile=$WMII_NAMESPACE/.proglist path_ls $PATH > $progsfile & -eval arg `scansection Key|cut -sf2` |a $WMII_DIR/keys +eval arg `scansection Key|cut -sf2` >> $WMII_DIR/keys # Clear the LBar find $WMII_DIR/lbar -type f -delete @@ -265,6 +253,6 @@ fi trap "Event Quit" EXIT # use wmiir so it doesn't look like an open file -wmiir read /event 2>/dev/null | while read event; do +wmiir read /event | while read event; do Event $event done -- cgit v1.2.3