void uicb_tag_move_client_prev(Uicb cmd) { (void)cmd; struct tag *t; if(!W->client) return; if((t = TAILQ_PREV(W->screen->seltag, tsub, next))) tag_client(t, W->client); else if( /* CIRCULAR OPTION */ 1) tag_client(TAILQ_LAST(&W->screen->tags, tsub), W->client); }
void uicb_tag_move_client_next(Uicb cmd) { (void)cmd; struct tag *t; if(!W->client) return; if((t = TAILQ_NEXT(W->screen->seltag, next))) tag_client(t, W->client); else if(W->flags & WMFS_TAGCIRC) tag_client(TAILQ_FIRST(&W->screen->tags), W->client); }
void uicb_tag_move_client_next(Uicb cmd) { (void)cmd; struct tag *t; if(!W->client) return; if((t = TAILQ_NEXT(W->screen->seltag, next))) tag_client(t, W->client); else if( /* CIRCULAR OPTION */ 1) tag_client(TAILQ_FIRST(&W->screen->tags), W->client); }
void tag_screen(struct screen *s, struct tag *t) { struct client *c; /* Return to the previous tag */ if(t == s->seltag && TAILQ_NEXT(TAILQ_FIRST(&s->tags), next)) t = t->prev; if(!t) t = TAILQ_FIRST(&s->tags); /* Move clients which ignore tags */ SLIST_FOREACH(c, &W->h.client, next) if (c->flags & CLIENT_IGNORE_TAG) tag_client(t, c); t->prev = s->seltag; s->seltag = t; clients_arrange_map(); /* Update focus */ if(!SLIST_EMPTY(&t->clients) && !(W->flags & WMFS_SCAN)) client_focus( client_tab_next(t->sel)); t->flags &= ~TAG_URGENT; infobar_elem_screen_update(s, ElemTag); ewmh_update_wmfs_props(); }
/** Get or set the clients attached to this tag. * \param L The Lua VM state. * \return The number of elements pushed on stack. * \luastack * \lparam None or a table of clients to set. * \lreturn A table with the clients attached to this tags. */ static int luaA_tag_clients(lua_State *L) { tag_t **tag = luaA_checkudata(L, 1, "tag"); client_array_t *clients = &(*tag)->clients; int i; if(lua_gettop(L) == 2) { client_t **c; luaA_checktable(L, 2); for(i = 0; i < (*tag)->clients.len; i++) untag_client((*tag)->clients.tab[i], *tag); lua_pushnil(L); while(lua_next(L, 2)) { c = luaA_checkudata(L, -1, "client"); tag_client(*c, *tag); lua_pop(L, 1); } } luaA_otable_new(L); for(i = 0; i < clients->len; i++) { luaA_client_userdata_new(L, clients->tab[i]); lua_rawseti(L, -2, i + 1); } return 1; }
/** Get or set the clients attached to this tag. * \param L The Lua VM state. * \return The number of elements pushed on stack. * \luastack * \lparam None or a table of clients to set. * \lreturn A table with the clients attached to this tags. */ static int luaA_tag_clients(lua_State *L) { tag_t *tag = luaL_checkudata(L, 1, "tag"); client_array_t *clients = &tag->clients; int i; if(lua_gettop(L) == 2) { luaA_checktable(L, 2); foreach(c, tag->clients) untag_client(*c, tag); lua_pushnil(L); while(lua_next(L, 2)) { client_t *c = luaA_client_checkudata(L, -1); /* push tag on top of the stack */ lua_pushvalue(L, 1); tag_client(c); lua_pop(L, 1); } } lua_createtable(L, clients->len, 0); for(i = 0; i < clients->len; i++) { client_push(L, clients->tab[i]); lua_rawseti(L, -2, i + 1); } return 1; }
/* Set t to NULL to untag c from c->tag */ void tag_client(struct tag *t, struct client *c) { /* Remove client from its previous tag */ if(c->tag && !(c->flags & CLIENT_RULED)) { if(c->tag == t) return; if(!(c->flags & (CLIENT_IGNORE_LAYOUT | CLIENT_FREE))) layout_split_arrange_closed(c); if(!(c->flags & CLIENT_REMOVEALL)) { SLIST_REMOVE(&c->tag->clients, c, client, tnext); if(c->tag->sel == c || W->client == c) client_focus( client_tab_next( client_next(c))); } } c->flags &= ~CLIENT_RULED; /* Client remove */ if(!t) { infobar_elem_screen_update(c->screen, ElemTag); return; } c->prevtag = c->tag; c->tag = t; c->screen = t->screen; client_update_props(c, CPROP_LOC); SLIST_INSERT_HEAD(&t->clients, c, tnext); infobar_elem_screen_update(c->screen, ElemTag); if(c->flags & CLIENT_TABMASTER && c->prevtag) { struct client *cc; SLIST_FOREACH(cc, &c->prevtag->clients, tnext) if(cc->tabmaster == c) { cc->flags |= CLIENT_IGNORE_LAYOUT; tag_client(t, cc); } } layout_client(c); if(t != c->screen->seltag || c->flags & CLIENT_TABBED) client_unmap(c); }
void uicb_tag_client(Uicb cmd) { struct tag *t; int id = ATOI(cmd); if(W->client && (t = tag_gb_id(W->screen, id))) tag_client(t, W->client); }
void uicb_screen_move_client_prev(Uicb cmd) { struct screen *s = SLIST_FIRST(&W->h.screen); (void)cmd; while(SLIST_NEXT(s, next) && SLIST_NEXT(s, next) != s) s = SLIST_NEXT(s, next); if(W->client) tag_client(s->seltag, W->client); }
void uicb_screen_move_client_next(Uicb cmd) { struct screen *s = SLIST_NEXT(W->screen, next); (void)cmd; if(!s) s = SLIST_FIRST(&W->h.screen); if(W->client) tag_client(s->seltag, W->client); }