-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
Here is another trick you can try, if you have GNU BASH or you can
easily rewrite it in pure SH, to cycle to the next and previous
workspaces like wmii 2.5.2. The order of cycling corresponds
*exactly* to the order of tag-buttons on left-hand corner of the
wmiibar.
This is especially useful when you start giving alphabetic names to
tags (instead of the default 0-9 digits) because there isn't a
quicker[1] shortcut like $MODKEY-Shift-[0-9] to select alphabetic tags.
To use, just call the cycleWs function with argument 'next' or
'prev' to cycle to the respective workspace.
Cheers.
[1] IMHO the second-quickest method is $MODKEY-t and then using
tab-completion with wmiimenu, but often I feel lazy to type so much. ;-)
## the code (for wmiirc):
# Cycles through all available workspaces (the tags shown as buttons
on wmiibar).
# @param . 'next' or 'prev'
cycleWs() {
# gather a list of available workspaces
list=( $( wmiir read /tags | sort ) ) # sort because tags shown on
wmiibar are sorted
listLen=${#list[@]}
listIndexMax=$(( listLen - 1 ))
# determine current workspace
ws=$(wmiir read /view/sel/sel/tags)
wsIndex=0
for (( i = 0; i < listLen; i++ )); do
if test ${list[$i]} = $ws; then
wsIndex=$i
break
fi
done
# determine new workspace
wsIndexNext=$(( (wsIndex + 1) % listLen ))
wsIndexPrev=$(( wsIndex - 1 ))
(( wsIndexPrev < 0 )) && wsIndexPrev=$listIndexMax
# cycle to the new workspace
case "$1" in
next)
wsIndexNew=$wsIndexNext ;;
prev)
wsIndexNew=$wsIndexPrev ;;
*)
wsIndexNew=$wsIndex ;;
esac
echo -n "view ${list[$wsIndexNew]}" | wmiir write /ctl
}
## the event handlers (inside wmiirc's big case statement):
$MODKEY-comma)
cycleWs prev;;
$MODKEY-period)
cycleWs next;;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEPIMVmV9O7RYnKMcRApmSAJ9+7/MQ4dfOTa7K4TGCHxOzyw0WegCfSlJp
pEzVW4B1mwcObOZlL9Ul9BA=
=d313
-----END PGP SIGNATURE-----
Received on Wed Apr 12 2006 - 06:33:37 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:02:26 UTC