#!/bin/bash # configure wmii xwrite() { file="$1"; shift echo -n "$@" | wmiir write "$file" } proglist() { ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u } #MODKEY=Mod1 MODKEY=Mod4 UP=k DOWN=j LEFT=h RIGHT=l WMII_FONT='-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*' WMII_SELCOLORS='#ffffff #0a55e0 #5589ff' # font background border WMII_NORMCOLORS='#000000 #888888 #a8a8a8' #export WMII_FONT WMII_NORMCOLORS WMII_SELCOLORS # give wmiiwm a chance to start while : do echo Start wmiirc | wmiir write /event >/dev/null 2>&1 && break sleep 1 done # WM CONFIGURATION xwrite /def/border 1 xwrite /def/font $WMII_FONT xwrite /def/selcolors $WMII_SELCOLORS xwrite /def/normcolors $WMII_NORMCOLORS xwrite /def/colmode default xwrite /def/colwidth 0 # TAGGING RULES wmiir write /def/rules < ~ /MPlayer.*/ -> ~ /Tenace.*/ -> ~ /XMMS.*/ -> ~ /Workrave.*/ -> 0 /.*Iceweasel/ -> 2 /.*/ -> ! /.*/ -> 1 EOF # MISC #xsetroot -solid '#333333' $HOME/.wmii-3/status & PROGS_FILE=`mktemp /tmp/.wmiimenu.proglist.XXXXXX` || exit 2 proglist `echo "$OLD_PATH" | tr : ' '` >$PROGS_FILE & # SHORTCUTS xwrite /def/grabmod Mod1 wmiir write /def/keys </dev/null | while read type arg1 arg2 arg3 do case "$type" in Start) if test wmiirc = "$arg1" then rm -f $PROGS_FILE exit fi;; BarClick) case $arg1 in [0-9]) xwrite /ctl view "$arg1" ;; ??_birthday) wmiir remove /bar/70_birthday ;; ??_clock) plan & ;; ??_log) xterm -e less +F /var/log/syslog & ;; ??_timer) case $arg2 in 1) pkill -PWR timer ;; 2) pkill -USR1 timer ;; 3) pkill -USR2 timer ;; esac ;; *) echo $0: $arg1 $arg2 $arg3 ;; esac ;; Key) case "$arg1" in $MODKEY-$LEFT) warp=1 xwrite /view/ctl select prev;; $MODKEY-$RIGHT) warp=1 xwrite /view/ctl select next;; $MODKEY-$DOWN) warp=1 xwrite /view/sel/ctl select next;; $MODKEY-$UP) warp=1 xwrite /view/sel/ctl select prev;; $MODKEY-space) xwrite /view/ctl select toggle;; $MODKEY-d) xwrite /view/sel/mode default;; $MODKEY-s) xwrite /view/sel/mode stack;; $MODKEY-m) xwrite /view/sel/mode max;; $MODKEY-f) xwrite /view/0/sel/geom 0 0 east south;; $MODKEY-a) PATH="$HOME/.wmii-3:/etc/X11/wmii-3:$PATH" `proglist $HOME/.wmii-3 /etc/X11/wmii-3 | wmiimenu` &;; $MODKEY-p) PATH="$OLD_PATH" wmiisetsid `wmiimenu <$PROGS_FILE` &;; $MODKEY-t) xwrite /ctl view "`wmiir read /tags | wmiimenu`" &;; $MODKEY-[0-9]) xwrite /ctl view `echo $arg1 | sed 's/.*-//'`;; $MODKEY-Return) PATH="$OLD_PATH" SHLVL=0 xterm &;; $MODKEY-Shift-$LEFT) warp=1 xwrite /view/sel/sel/ctl sendto prev;; $MODKEY-Shift-$RIGHT) warp=1 xwrite /view/sel/sel/ctl sendto next;; $MODKEY-Shift-$DOWN) warp=1 xwrite /view/sel/sel/ctl swap down;; $MODKEY-Shift-$UP) warp=1 xwrite /view/sel/sel/ctl swap up;; $MODKEY-Shift-space) xwrite /view/sel/sel/ctl sendto toggle;; $MODKEY-Shift-c|$MODKEY-x) xwrite /view/sel/sel/ctl kill;; $MODKEY-Shift-t) xwrite /view/sel/sel/tags "`wmiir read /tags | wmiimenu`" &;; $MODKEY-Shift-[0-9]) xwrite /view/sel/sel/tags `echo $arg1 | sed 's/.*-//'`;; $MODKEY-Control-$LEFT) warp=1 xwrite /view/sel/sel/ctl swap prev;; $MODKEY-Control-$RIGHT) warp=1 xwrite /view/sel/sel/ctl swap next;; $MODKEY-Control-$DOWN) warp=1 xwrite /view/sel/sel/ctl swap down;; $MODKEY-Control-$UP) warp=1 xwrite /view/sel/sel/ctl swap up;; esac;; ClientFocus) if [ "$warp" ] ; then set -- `wmiir read /client/$arg1/geom` wmiiwarp $(($1 + 9)) $(($2 + 16)) unset warp fi ;; NextTag) nexttag="$arg1" ;; CreateClient) # n if [ "$nexttag" ] ; then xwrite /client/$arg1/tags "$nexttag" nexttag='' fi ;; *) echo $0: $type $arg1 $arg2 $arg3 ;; esac done &