Hi everyone,
I'm quite used to alt-tab like cycling through open program windows and
I was missing that in dwm.
I wrote one for the current version where
next_client() moves the next visible client to the master area and moves
the old one to the *end* of the stack ( counter clockwise movement )
and
prev_client() pulls the last visible client to the master area and moves
the current one to the top ( clock-wise )
just add this file to your config.h and make your bindings...
comments are welcome.
Client *next_visible();
Client *prev_visible(Client *c);
Client *last_client();
void attach_to_end(Client *c);
void next_client(const char *arg);
void prev_client(const char *arg);
void
attach_to_end(Client *c) {
Client *last = last_client();
if( last == NULL )
{
attach(c);
return;
}
last->next = c;
c->prev = last;
c->next = NULL;
}
Client*
prev_visible(Client *c)
{
Client* dum = c;
while( dum && !isvisible(dum) )
dum = dum->prev;
return dum;
}
Client*
next_visible()
{
Client *c=clients;
while( c && !isvisible(c) )
{
c = c->next;
}
return c;
}
void
next_client(const char *arg)
{
Client *c = next_visible();
if( !c ) return;
detach(c);
attach_to_end(c);
Client *nc = next_visible();
focus(nc);
arrange();
}
void
prev_client(const char *arg)
{
sel = last_client();
if(!sel) return;
while( !isvisible(sel) )
sel = prev_visible(sel);
if(!sel) return;
zoom(NULL);
}
Client* last_client() {
Client* dum = clients;
if( !dum ) return NULL;
while( dum->next )
dum=dum->next;
return dum;
}
--
engin tola - http://cvlab.epfl.ch/~tola