Re: [dev] [dwm] question regarding floating clients being always on top

From: Uli Armbruster <uli.armbruster_AT_googlemail.com>
Date: Fri, 24 Feb 2012 09:21:32 +0100

* Bert Münnich <be.muennich_AT_googlemail.com> [23.02.2012 21:04]:
> On 20.02.12, Uli Armbruster wrote:
> > By default, floating clients are always on top of tiled clients. I'd
> > like to change this behavior to make it possible to use floating and
> > tiled clients together (either having the same tag or if multiple tags
> > are selected) so the currently selected client is on top, no matter if
> > it's floating or tiled.
> >
> > So, where can I find this in the source code?
>
> The first attached patch does the trick, but only when using the
> keyboard mappings (mod-[jk], focusstack).
>
> The second one adds the behaviour for sloppy focus.
>
> Bert

> diff -rup dwm-6.0-orig/dwm.c dwm-6.0/dwm.c
> --- dwm-6.0-orig/dwm.c 2011-12-19 22:22:25.000000000 +0100
> +++ dwm-6.0/dwm.c 2012-02-23 20:48:28.000000000 +0100
> _AT_@ -1420,13 +1420,12 @@ restack(Monitor *m) {
> drawbar(m);
> if(!m->sel)
> return;
> - if(m->sel->isfloating || !m->lt[m->sellt]->arrange)
> - XRaiseWindow(dpy, m->sel->win);
> + XRaiseWindow(dpy, m->sel->win);
> if(m->lt[m->sellt]->arrange) {
> wc.stack_mode = Below;
> wc.sibling = m->barwin;
> for(c = m->stack; c; c = c->snext)
> - if(!c->isfloating && ISVISIBLE(c)) {
> + if(c != m->sel && !c->isfloating && ISVISIBLE(c)) {
> XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
> wc.sibling = c->win;
> }

> diff -rup dwm-6.0-orig/dwm.c dwm-6.0/dwm.c
> --- dwm-6.0-orig/dwm.c 2011-12-19 22:22:25.000000000 +0100
> +++ dwm-6.0/dwm.c 2012-02-23 21:00:26.000000000 +0100
> _AT_@ -456,6 +456,7 @@ buttonpress(XEvent *e) {
> }
> else if((c = wintoclient(ev->window))) {
> focus(c);
> + restack(selmon);
> click = ClkClientWin;
> }
> for(i = 0; i < LENGTH(buttons); i++)
> _AT_@ -829,6 +830,7 @@ enternotify(XEvent *e) {
> else if(!c || c == selmon->sel)
> return;
> focus(c);
> + restack(selmon);
> }
>
> void

Thanks a lot Bert! The first patch is what I was looking for. Now that I see it it makes completely sense :)
Received on Fri Feb 24 2012 - 09:21:32 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 24 2012 - 09:24:04 CET