Re: [dwm] killclient and focus

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri, 21 Dec 2007 21:14:43 +0100

On Fri, Dec 21, 2007 at 05:48:57PM +0300, Станислав wrote:
> Hi, All.
>
> DWM remember which client was focused lat. When I close my current
> window by modkey+shift+c, focus folow to previous active, but client
> dont move to master area. Its not useful.
> How can I change dwm source to work it properly?
>
> I have changed dwm.c, but this not the best.
>
> diff -ur dwm-4.7/dwm.c dwm-4.7_gin/dwm.c
> --- dwm-4.7/dwm.c 2007-11-21 23:18:41.000000000 +0300
> +++ dwm-4.7_gin/dwm.c 2007-12-21 16:49:27.000000000 +0300
> @@ -988,6 +988,8 @@
> }
> else
> XKillClient(dpy, sel->win);
> + focusnext(NULL);
> + zoom(NULL);
> }
>
> void

I doubt what you do is the correct way. First of all you don't
need to change dwm.c at all for achieving this, you get the same
behavior as follows from config.h:

        { MODKEY|ShiftMask, XK_c, killclient, NULL },
        { MODKEY|ShiftMask, XK_c, focusnext, NULL },
        { MODKEY|ShiftMask, XK_c, zoom, NULL },

However I won't do that. killclient() will politely ask an X
client to close the window and if that is finished, dwm will
receive an unmapwindow or destroywindow notification event.
This will trigger unmanage(), which basicually does similiar
things which you try to aim, but more correctly, working on the
focus history stack, thus focussing the really chronocally
previously focussed window.

The way as dwm works in this regard is correct, because it is a
general purpose mechanism which never breaks in any regard.

Your change will work out badly if you consider a popup window
being closed using Mod-Shift-c for instance. So I really
recommend you, don't do it.

Regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Fri Dec 21 2007 - 21:14:43 UTC

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