diff --git a/ewmh.c b/ewmh.c index 933329ce..33026263 100644 --- a/ewmh.c +++ b/ewmh.c @@ -446,6 +446,26 @@ ewmh_client_update_hints(client_t *c) c->win, _NET_WM_STATE, ATOM, 32, i, state); } +/** Update the client active desktop. + * This is "wrong" since it can be on several tags, but EWMH has a strict view + * of desktop system so just take the first tag. + * \param c The client. + */ +void +ewmh_client_update_desktop(client_t *c) +{ + int i; + tag_array_t *tags = &globalconf.screens[c->screen].tags; + + for(i = 0; i < tags->len; i++) + if(is_client_tagged(c, tags->tab[i])) + { + xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, + c->win, _NET_WM_DESKTOP, CARDINAL, 32, 1, &i); + return; + } +} + void ewmh_client_check_hints(client_t *c) { diff --git a/ewmh.h b/ewmh.h index bbfd2a73..2e0210e5 100644 --- a/ewmh.h +++ b/ewmh.h @@ -34,6 +34,7 @@ int ewmh_process_client_message(xcb_client_message_event_t *); void ewmh_update_net_client_list_stacking(int); void ewmh_client_check_hints(client_t *); void ewmh_client_update_hints(client_t *); +void ewmh_client_update_desktop(client_t *); void ewmh_update_workarea(int); void ewmh_client_strut_update(client_t *, xcb_get_property_reply_t *); xcb_get_property_cookie_t ewmh_window_icon_get_unchecked(xcb_window_t); diff --git a/tag.c b/tag.c index 55f2b139..10a611be 100644 --- a/tag.c +++ b/tag.c @@ -144,6 +144,7 @@ tag_client(client_t *c, tag_t *t) tag_ref(&t); client_array_append(&t->clients, c); client_saveprops_tags(c); + ewmh_client_update_desktop(c); client_need_arrange(c); /* call hook */ if(globalconf.hooks.tagged != LUA_REFNIL) @@ -167,6 +168,7 @@ untag_client(client_t *c, tag_t *t) client_need_arrange(c); client_array_take(&t->clients, i); client_saveprops_tags(c); + ewmh_client_update_desktop(c); /* call hook */ if(globalconf.hooks.tagged != LUA_REFNIL) {