Re: [wmii] cycle through workspaces like 2.5.2

From: Anselm R. Garbe <garbeam_AT_wmii.de>
Date: Wed, 12 Apr 2006 08:42:56 +0200

I also switched to alphanumeric names (0-scratch, 1-dev, 2-mail,
3-irc, 4-www, 5-cert), but I defined the numbers in the name
according to the keys I access those tags (though I removed 6-9,
because I don't need more tags).
        
        --Anselm

On Tue, Apr 11, 2006 at 09:33:25PM -0700, Suraj N. Kurapati wrote:
> -----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-----
>
> _______________________________________________
> wmii_AT_wmii.de mailing list
> http://wmii.de/cgi-bin/mailman/listinfo/wmii

-- 
 Anselm R. Garbe  ><><  www.ebrag.de  ><><  GPG key: 0D73F361
Received on Wed Apr 12 2006 - 08:42:56 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:02:28 UTC