Re: [wmii] wmiirc snippet: tag comments

From: Bill Puschmann <puschy_AT_gmail.com>
Date: Mon, 17 Sep 2007 12:21:07 -0400

IIRC the original intent was to have tags with words rather than numbers.
Using numbers encourages a "workspace" mentality rather than the "keyword"
concept. Work with words rather than numbers for a bit and it should become
much more clear. Otherwise the whole idea of "removing workspaces" becomes
pointless. Because you're still thinking of them as workspaces. If I have
a mail application open - I don't want to think of it tagged with "1" and
"2"... it should be tagged "work" and "net" because that's what it is.

It's agreed that numbers are faster... there is (or was) a snippet posted on
the website that would:
1) read in the names of tags
2) alphabetize
3) read in a number
4) jump to the tag that number of tags in (which makes no sense when I
write it)

So, if you have the tags "code, gimp, net, work", pressing MOD+1 accesses
"code", MOD+2 accesses "gimp" etc.

And it should be easy to keep track of if the number of tags is small. I
can see that net is the third, gimp is the fourth... And if "code" goes
away, "gimp" becomes 1. No hardcoding tags.

Actually, the code in question is still there:
http://www.suckless.org/wiki/wmii/tips/code_snippets - check "switched to
named view by number"

On 9/16/07, Boo_boo <kaitarou_AT_gmail.com> wrote:
>
> (sorry, i've posted this message prevously, but to wrong thread)
>
> generally i use numeric tagnames in wmii, because it's easier and faster
> to tag with and to navigate between views.
> but numbers are'nt of any information about what is that tag for.
> so i scripted wmii to support "tag comments"; the comment is some string,
> which may be assotiated with tag, and will be shown in tagbar/tagmenu after
> the tag name. maybe someone will find that feature useful too.
>
> paste these lines somewhere near tagging rules:
> #------
> #predefined tag comments (example)
> TAG_COMMENTS=$(cat<<!
> 1 -> www
> 3 -> dev
> 4 -> icq
> !
> )
>
> #string to delimit tag name and tag comment in tagbar/tagmenu
> TAG_CDELIM="-"
>
> #outputs tag name with optional comment
> tag_display() {
> echo -n $1`echo "$TAG_COMMENTS" | sed -n
> 's|^'$1'\s->\s\(.*\)$|'$TAG_CDELIM'\1|p'`
> }
> #------
>
> paste these to keys definition block:
> #------
> #set comment for current view tag ('d' for 'describe')
> Key $MODKEY-Shift-d
> tag_choosen=`wmiir read /tag/sel/ctl`
> new_comment=$(echo | $WMII_MENU)
> TAG_COMMENTS=`echo "$TAG_COMMENTS" | sed
> '/^'$tag_choosen'\s->\s/d'`
> if [ -n "$new_comment" ]
> then
> TAG_COMMENTS=$TAG_COMMENTS$'\n'"$tag_choosen ->
> $new_comment"
> fi
> wmiir xwrite "/lbar/$tag_choosen" "$WMII_FOCUSCOLORS"
> "$(tag_display "$tag_choosen")"
> #------
>
> replase tagsmenu() function with:
> #------
> tagsmenu() {
> all_tags=`wmiir ls /tag | sed 's|/||; /^sel$/d'`
> for tag in $all_tags
> do
> menu_tags="$menu_tags"$(tag_display "$tag")$'\n'
> done
> choice=`echo -n "$menu_tags" | $WMII_MENU`
> for tag in $all_tags
> do
> if [ "$choice" = "$(tag_display "$tag")" ]
> then
> echo -n "$tag"
> return 0
> fi
> done
> echo "$choice"
> }
> #------
>
> and, finally, replace tag name in all wmiirc tag names display code with
> "$(tag_display $tag_name)"
> #------
> Event CreateTag
> echo "$WMII_NORMCOLORS" "$(tag_display "$@")" | wmiir
> create "/lbar/$@"
> #------
>
> #------
> Event FocusTag
> wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" "$(tag_display
> "$@")"
> Event UnfocusTag
> wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" "$(tag_display
> "$@")"
> Event UrgentTag
> shift
> wmiir xwrite "/lbar/$@" "*""$(tag_display "$@")"
> Event NotUrgentTag
> shift
> wmiir xwrite "/lbar/$@" "$(tag_display "$@")"
> #------
>
> #------
> # Setup Tag Bar
> seltag="$(wmiir read /tag/sel/ctl 2>/dev/null)"
> wmiir ls /lbar |
> while read bar; do
> wmiir remove "/lbar/$bar"
> done
> wmiir ls /tag | sed -e 's|/||; /^sel$/d' |
> while read tag; do
> if [ "X$tag" = "X$seltag" ]; then
> echo "$WMII_FOCUSCOLORS" "$(tag_display "$tag")" | wmiir
> create "/lbar/$tag"
> else
> echo "$WMII_NORMCOLORS" "$(tag_display "$tag")" | wmiir
> create "/lbar/$tag"
> fi
> done
> #------
>
>
> --
> With best regards,
> Boo-boo
>
> mailto: kaitarou(^at^)gmail.com
>
> --
> With best regards,
> Boo-boo
>
> mailto: kaitarou_AT_gmail.com
>
>

-- 
"You took the words right out of my mouth, Penfold"
"Sorry, sir, do you want them back?"
Received on Mon Sep 17 2007 - 18:21:12 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:27:42 UTC