[hackers] wmii-3.5: new tip (= 1716)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sat, 03 Feb 2007 00:10:04 +0100

changeset: 1716:337580ce8fd2
tag: tip
user: Denis Grelich <denisg_AT_suckless.org>
date: Fri Feb 02 23:58:17 2007 +0100
files: view.c
description:
removed some older code

changeset: 1715:ca791c99c1b4
user: Denis Grelich <denisg_AT_suckless.org>
date: Fri Feb 02 23:57:40 2007 +0100
files: rc/wmiirc
description:
some smaller fixes in the wmiirc

changeset: 1714:c51bc117ad24
user: Denis Grelich <denisg_AT_suckless.org>
date: Fri Feb 02 23:32:38 2007 +0100
files: view.c
description:
fixed the stacking order on focus change in the floating layer. Welcome back Kris!

diff -r b679aeeb9fb6 -r 337580ce8fd2 rc/wmiirc
--- a/rc/wmiirc Fri Feb 02 17:43:22 2007 +0100
+++ b/rc/wmiirc Fri Feb 02 23:58:17 2007 +0100
@@ -1,6 +1,7 @@
 #!/bin/sh
-# configure wmii
-
+# Configure wmii
+
+# FUNCTIONS
 xwrite() {
         file="$1"; shift
         echo -n "$@" | wmiir write "$file"
@@ -11,19 +12,19 @@ proglist() {
 }
 
 conf_which () {
- if [ -n "$1" ]
+ prog=$1; shift
+ if [ -n "$prog" ]
         then
- prog=$1; shift
                 echo `PATH="$WMII_CONFPATH:$PATH" which $prog` "$@"
         fi
 }
 
 tagsmenu() {
         tag=`wmiir read /tag/sel/ctl`
- tags=`wmiir ls /tag | sed 's|/||; /^sel$/d' | awk "BEGIN{print \"$tag\"} !/^$tag\$/" | $DMENU`
- test -n "$tags" && xwrite $@ "$tags"
-}
-
+ wmiir ls /tag | { echo $tag; sed "s|/||; /^\(sel|$tag\)\$/d";} | $DMENU
+}
+
+# CONFIGURATION VARIABLES
 MODKEY=Mod1
 UP=k
 DOWN=j
@@ -31,7 +32,7 @@ RIGHT=l
 RIGHT=l
 
 WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*'
-# colors are text, bg, border
+# Colors tuples are "<text> <background> <border>"
 WMII_NORMCOLORS='#222222 #eeeeee #666666'
 WMII_SELCOLORS='#444444 #bbbbbb #556088'
 WMII_FOCUSCOLORS='#ffffff #335577 #447799'
@@ -41,9 +42,6 @@ WMII_TERM="xterm"
 WMII_TERM="xterm"
 
 export DMENU WMII_FONT WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS WMII_TERM
-
-# stop any running instances of wmiirc
-echo Start wmiirc | wmiir write /event || exit 1
 
 # WM CONFIGURATION
 wmiir write /ctl << EOF
@@ -70,13 +68,17 @@ EOF
 EOF
 
 # MISC
-xsetroot -solid $WMII_BACKGROUND
-`conf_which status` &
 PROGS_FILE="$WMII_NS_DIR/.dmenu.proglist"
 ACTIONS_DIRS=`echo "$WMII_CONFPATH" | tr : ' '`
+
+`conf_which status` &
+xsetroot -solid $WMII_BACKGROUND
 proglist `echo "$PATH" | tr : ' '` >$PROGS_FILE &
 
-# SHORTCUTS
+# Stop any running instances of wmiirc
+echo Start wmiirc | wmiir write /event || exit 1
+
+# BOUND KEYS
 wmiir write /keys <<EOF
 $MODKEY-$LEFT
 $MODKEY-$RIGHT
@@ -120,7 +122,7 @@ wmiir write /keys <<EOF
 $MODKEY-Shift-9
 EOF
 
-# TAG BAR
+# SETUP TAG BAR
 wmiir ls /lbar |
 while read bar
 do
@@ -128,7 +130,7 @@ done
 done
 
 seltag="`wmiir read /tag/sel/ctl 2>/dev/null`"
-wmiir ls /tag | sed -e 's|/$||; /^sel$/d' |
+wmiir ls /tag | sed -e 's|/||; /^sel$/d' |
 while read tag
 do
         if [ "X$tag" = "X$seltag" ]; then
@@ -169,7 +171,8 @@ do
                 shift
                 xwrite /ctl view "$@";;
         Key)
- case "$1" in
+ key="$1"
+ case "$key" in
                 $MODKEY-$LEFT)
                         xwrite /tag/sel/ctl select left;;
                 $MODKEY-$RIGHT)
@@ -189,13 +192,13 @@ do
                 $MODKEY-f)
                         xwrite /tag/sel/0/sel/geom 0 0 0 0;;
                 $MODKEY-a)
- `conf_which "\`proglist $ACTIONS_DIRS | $DMENU\`"` &;;
+ `conf_which "$(proglist $ACTIONS_DIRS | $DMENU)"` &;;
                 $MODKEY-p)
                         sh -c "`$DMENU <$PROGS_FILE`" &;;
                 $MODKEY-t)
- tagsmenu /ctl view &;;
+ xwrite /ctl "view `tagsmenu`" &;;
                 $MODKEY-[0-9])
- xwrite /ctl view "`echo $1 | sed 's/.*-//'`";;
+ xwrite /ctl view "`echo $key | sed 's/.*-//'`";;
                 $MODKEY-Return)
                         $WMII_TERM &;;
                 $MODKEY-Shift-$LEFT)
@@ -211,9 +214,9 @@ do
                 $MODKEY-Shift-c)
                         xwrite /client/sel/ctl kill;;
                 $MODKEY-Shift-t)
- tagsmenu "/client/`wmiir read /client/sel/ctl`/tags" &;;
+ xwrite "/client/`wmiir read /client/sel/ctl`/tags" `tagsmenu` &;;
                 $MODKEY-Shift-[0-9])
- xwrite /client/sel/tags "`echo $1 | sed 's/.*-//'`";;
+ xwrite /client/sel/tags "`echo $key | sed 's/.*-//'`";;
                 esac;;
         esac
 done &
diff -r b679aeeb9fb6 -r 337580ce8fd2 view.c
--- a/view.c Fri Feb 02 17:43:22 2007 +0100
+++ b/view.c Fri Feb 02 23:58:17 2007 +0100
@@ -123,7 +123,7 @@ focus_view(WMScreen *s, View *v) {
                                                 f->rect.y);
                 }
         if((c = sel_client()))
- focus_client(c, True);
+ focus_client(c, False);
         draw_frames();
         XSync(blz.dpy, False);
         XUngrabServer(blz.dpy);
@@ -172,24 +172,26 @@ restack_view(View *v) {
         Client *c;
         unsigned int n=0, i=0;
         static Window *wins = NULL;
- static unsigned int winssz = 0;
 
         for(c=client; c; c=c->next, i++);
- if(i > winssz) {
- winssz = 2 * i;
- wins = ixp_erealloc(wins, sizeof(Window) * winssz);
- }
+ wins = ixp_erealloc(wins, sizeof(Window) * i);
+
         for(a=v->area; a; a=a->next) {
                 if(a->frame) {
+ if(a == v->area) {
+ Frame **tf;
+ for(tf=&a->frame; *tf; tf=&(*tf)->anext)
+ if(*tf == a->sel) break;
+ *tf = a->sel->anext;
+ a->sel->anext = a->frame;
+ a->frame = a->sel;
+ }
                         wins[n++] = a->sel->client->framewin;
- for(f=a->frame; f; f=f->anext)
- if(f != a->sel) n++;
- i=n;
                         for(f=a->frame; f; f=f->anext) {
                                 Client *c = f->client;
                                 update_client_grab(c, (v->sel == a) && (a->sel == f));
                                 if(f != a->sel)
- wins[--i] = c->framewin;
+ wins[n++] = c->framewin;
                         }
                 }
         }
Received on Sat Feb 03 2007 - 00:10:04 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:50 UTC