diff --git a/src/client.c b/src/client.c index ca63594..643a6cc 100644 --- a/src/client.c +++ b/src/client.c @@ -970,6 +970,8 @@ client_new(Window w, XWindowAttributes *wa, bool scan) ewmh_manage_window_type(c); } + ewmh_get_client_list(); + return c; } @@ -1408,6 +1410,8 @@ client_remove(struct client *c) XSetErrorHandler(wmfs_error_handler); free(c); + + ewmh_get_client_list(); } void diff --git a/src/ewmh.c b/src/ewmh.c index 8ea12ee..3e9823a 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -111,6 +111,33 @@ ewmh_set_wm_state(Window w, int state) W->net_atom[wm_state], 32, PropModeReplace, d, 2); } +/* + * _NET_CLIENT_LIST + */ +void +ewmh_get_client_list(void) +{ + Window *list; + struct client *c; + int win_n = 0; + + SLIST_FOREACH(c, &W->h.client, next) + ++win_n; + + list = xcalloc(win_n, sizeof(Window)); + + win_n = 0; + SLIST_FOREACH(c, &W->h.client, next) + list[win_n++] = c->win; + + XChangeProperty(W->dpy, W->root, W->net_atom[net_client_list], XA_WINDOW, 32, + PropModeReplace, (unsigned char *)list, win_n); + + XFree(list); + + return; +} + /* * Get xembed state */ diff --git a/src/ewmh.h b/src/ewmh.h index e7aa2b0..5540979 100644 --- a/src/ewmh.h +++ b/src/ewmh.h @@ -118,6 +118,7 @@ ewmh_send_message(Window d, Window w, char *atom, long d0, long d1, long d2, lon void ewmh_init(void); void ewmh_set_wm_state(Window w, int state); +void ewmh_get_client_list(void); long ewmh_get_xembed_state(Window win); void ewmh_update_wmfs_props(void); void ewmh_manage_state(long data[], struct client *c);