diff --git a/ewmh.c b/ewmh.c index 39832210..daf0d692 100644 --- a/ewmh.c +++ b/ewmh.c @@ -365,7 +365,15 @@ ewmh_process_client_message(xcb_client_message_event_t *ev) client_t *c; if(ev->type == _NET_CURRENT_DESKTOP) - tag_view_only_byindex(ev->data.data32[0]); + { + int idx = ev->data.data32[0]; + if (idx >= 0 && idx < globalconf.tags.len) + { + luaA_object_push(globalconf.L, globalconf.tags.tab[idx]); + luaA_object_emit_signal(globalconf.L, -1, "request::select", 0); + lua_pop(globalconf.L, 1); + } + } else if(ev->type == _NET_CLOSE_WINDOW) { if((c = client_getbywin(ev->window))) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index c9db9d87..2273d473 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -571,6 +571,7 @@ capi.client.connect_signal("manage", function(c, startup) end) capi.client.connect_signal("manage", tag.withcurrent) +capi.tag.connect_signal("request::select", tag.viewonly) capi.tag.add_signal("property::hide") capi.tag.add_signal("property::icon") diff --git a/objects/tag.c b/objects/tag.c index cff1981b..23007a40 100644 --- a/objects/tag.c +++ b/objects/tag.c @@ -161,23 +161,6 @@ tags_get_first_selected_index(void) return 0; } -/** View only a tag, selected by its index. - * \param dindex The index. - */ -void -tag_view_only_byindex(int dindex) -{ - if(dindex < 0 || dindex >= globalconf.tags.len) - return; - - foreach(tag, globalconf.tags) - { - luaA_object_push(globalconf.L, *tag); - tag_view(globalconf.L, -1, *tag == globalconf.tags.tab[dindex]); - lua_pop(globalconf.L, 1); - } -} - /** Create a new tag. * \param L The Lua VM state. * \luastack @@ -365,6 +348,7 @@ tag_class_setup(lua_State *L) signal_add(&tag_class.signals, "property::name"); signal_add(&tag_class.signals, "property::selected"); signal_add(&tag_class.signals, "property::activated"); + signal_add(&tag_class.signals, "request::select"); signal_add(&tag_class.signals, "tagged"); signal_add(&tag_class.signals, "untagged"); } diff --git a/objects/tag.h b/objects/tag.h index 0498e531..b9d43193 100644 --- a/objects/tag.h +++ b/objects/tag.h @@ -28,7 +28,6 @@ int tags_get_first_selected_index(void); void tag_client(client_t *); void untag_client(client_t *, tag_t *); bool is_client_tagged(client_t *, tag_t *); -void tag_view_only_byindex(int); void tag_unref_simplified(tag_t **); ARRAY_FUNCS(tag_t *, tag, tag_unref_simplified)