On 8/17/06, Denis Grelich <[EMAIL PROTECTED]> wrote:
On Thu, 17 Aug 2006 18:56:55 +0200
"Anselm R. Garbe" <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 17, 2006 at 04:32:33PM +0200, Adam Ritter wrote:
> > It would be nice if a script could be notified if a client is
> > closed. It would be easy to remember kill commands, but if the user
> > closes the window the script won't be notified. I.e. if I create a
> > key for focusing the ncmpc window and optionally creating a client,
> > after the client is closed, it won't create an ncmpc client again
> > (the script could always check if it is the right client, but that
> > has limitations).
>
> Why not writing a wrapper script for the kill command? You could
> check the client's props (class:inst) and decide what todo,
> before writing kill. I see no need for the event you request.
A kill command is not the only way to close a client/destroy a window,
isn't it.
Yes, that's the problem. And the indexes of the clients change (when
destroy_client calls cext_vdetach), so the script must know about
every DestroyClient event to trace the index changes.
It was easy to write, so here's the patch:
*** wmii-3.1/cmd/wm/client.c Sat Jun 17 13:44:30 2006
--- wmii-3.1-new/cmd/wm/client.c Tue Aug 8 13:19:11 2006
*************** void
*** 446,451 ****
--- 446,452 ----
destroy_client(Client *c)
{
unsigned int i;
+ static char buf[256];
XGrabServer(dpy);
XSetErrorHandler(dummy_error_handler);
*************** destroy_client(Client *c)
*** 463,468 ****
--- 464,471 ----
reparent_client(c, root, c->rect.x, c->rect.y);
XFreeGC(dpy, c->gc);
XDestroyWindow(dpy, c->framewin);
+ snprintf(buf, sizeof(buf), "DestroyClient %d\n",
idx_of_client_id(c->id));
+ write_event(buf);
cext_vdetach(vector_of_clients(&client), c);
update_views();
free(c);
_______________________________________________
wmii@wmii.de mailing list
http://wmii.de/cgi-bin/mailman/listinfo/wmii