Re: [dwm] clientspertag status message

From: Ritesh Kumar <ritesh_AT_cs.unc.edu>
Date: Wed, 31 Oct 2007 20:37:30 -0400

On 10/31/07, Ritesh Kumar <ritesh_AT_cs.unc.edu> wrote:
>
> On 10/31/07, pancake <pancake_AT_youterm.com> wrote:
> <snip>
>
> > This still doesn't completely achieve the 'scolling through all windows'
> > > effect. Probably the easiest alternative (as you suggested) is to
> > zoom() on
> > > the focussed client automatically on focusnext() if cpt = 1... and
> > that
> > > would be a cool improvement to clientspertag. One way is to have a
> > > cptfocusnext doing the cpt related chores and calling the actual
> > focusnext
> > > appropriately. config.h handles binding Ctrl - j to cptfocusnext so
> > that's
> > > not a problem either. This solves the problem for clientspertag but
> > ofcourse
> > > is not general enough for a number of hooks (How about a config.c?
> > That
> > > could actually handle a lot of other problems too.).
> >
> > Uhm the zooming way is not ok at all because it modifies the clients
> > list
> > and breaks the focusnext()/focusprev(), so imho the right way to achieve
> > this is by having an index and a counter. Something like a moving window
> >
> > with
> >
> > Here's a sample:
> >
> > Window (size = cpt)
> > =-Index-=> +----------------------------------+
> > | |
> > [ client0 ] [ client1 ] [ client2 ] [ client3 ]
> >
> > So, we should be able to change the starting index into the clients list
> > to start handling clients and keeping cpt as the size of our view for
> > the current tag.
> >
> > So, we can hook ^alt+j and ^alt+k to move this index with soemthing like
> >
> > cptidx++ or so.
> >
> > We can make cptidx=0 when entering in 'cpt' mode. And always make't fit
> > for all the clients on the current view.
> >
> > This way. dwm.c will remain as is, and we can 'handle' when focusing a
> > non-visible client (out of the window) and shifting right or left the
> > window.
> >
> > I think this way we can make cpt more consistent and functional, but
> > we also need the visible-clients indicator.
> >
> > Thanks for discussing the cpt stuff. I need some feedback to think on
> > some concepts and so..let see if we finally got the proper approach
> > for this patch.
> >
> > --pancake
> >
> >
> You are right, zoom will alter the order of the clients in the client
> list.
> I am wondering, do you want the window scrolling behavior if there are two
> or more windows? My guess is that this is useful only if cpt = 1. Also,
> instead of using a cptidx you could just use sel (the currently selected
> client). Actually, forgive my impatience... I gave it a shot and the
> scrolling monocle works with the following patch :). The main trick is
> somehow calling arrange on a focus change.
> Using sel instead of cptidx also means that when I deactivate cpt mode,
> the window I am currently viewing (in monocle) is now the focussed window in
> the tiled layout. I guess we can move custom_focus* to nmaster.c so that
> it is less of a hack.
> What do you think?
>
> _r

Okay, a little bug fix. Now changing tagviews does the right thing. (Earlier
it used to not display anything on a view change but used to show something
the moment custom_focusnext was called).
Currently changing/toggling tags works correctly, however, the window in the
new view may or may not be focused :(. Any ideas?

diff -r 18756f3d803d config.h
--- a/config.h Tue Oct 30 22:39:33 2007 -0400
+++ b/config.h Wed Oct 31 15:08:00 2007 -0400
@@ -41,6 +41,20 @@ Layout layouts[] = {
 /* Status text */
 char* statusbar[] = { cptstext, inputtext };

+static void custom_focusnext(const char* a)
+{
+ focusnext(NULL);
+ if(cpt == 1)
+ arrange();
+}
+
+static void custom_focusprev(const char* a)
+{
+ focusprev(NULL);
+ if(cpt == 1)
+ arrange();
+}
+
 /* key definitions */
 #define MODKEY Mod1Mask
 #define KEYS \
@@ -54,8 +68,8 @@ Key keys[] = { \
        { MODKEY, XK_s, spawn, "exec
.dwm/audio_toggle.sh" }, \
        { MODKEY, XK_space, setlayout, NULL
}, \
        { MODKEY, XK_b, togglebar, NULL
}, \
- { MODKEY, XK_n, focusnext, NULL
}, \
- { MODKEY, XK_e, focusprev, NULL
}, \
+ { MODKEY, XK_n,
custom_focusnext, NULL }, \
+ { MODKEY, XK_e,
custom_focusprev, NULL }, \
        { MODKEY, XK_h, setmwfact, "-
0.05" }, \
        { MODKEY, XK_o, setmwfact,
"+0.05" }, \
        { MODKEY, XK_m, togglemax, NULL
}, \
diff -r 18756f3d803d nmaster.c
--- a/nmaster.c Tue Oct 30 22:39:33 2007 -0400
+++ b/nmaster.c Wed Oct 31 20:27:48 2007 -0400
@@ -96,12 +96,28 @@ void
 void
 ntile(void) {
        unsigned int i, n, nx, ny, nw, nh, mw, mh, th;
- Client *c;
+ Client *c, *t;

        for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
                n++;

        n = getclientspertag(n);
+
+ if(cpt == 1) { // Scrolling monocle layout
+ if(sel && isvisible(sel))
+ t = sel;
+ else
+ t = nexttiled(clients);
+ for(c = nexttiled(clients); c; c = nexttiled(c->next)){
+ if(c!=t){
+ ban(c);
+ continue;
+ }
+ }
+ if(t)
+ resize(t, wax, way, waw - 2*t->border, wah -
2*t->border, False);
+ return;
+ }

        /* window geoms */
        mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
Received on Thu Nov 01 2007 - 01:37:33 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:03:58 UTC