Tag: add uicb functions: tag_next_visible & tag_prev_visible.

This commit is contained in:
OldMan 2010-04-23 16:36:11 +06:00
parent 1d9bb77d83
commit 6d1bd844f7
4 changed files with 96 additions and 0 deletions

View File

@ -51,6 +51,8 @@ func_name_list_t tmp_func_list[] =
{"tag", uicb_tag },
{"tag_next", uicb_tag_next },
{"tag_prev", uicb_tag_prev },
{"tag_next_visible", uicb_tag_next_visible },
{"tag_prev_visible", uicb_tag_prev_visible },
{"tag_prev_sel", uicb_tag_prev_sel },
{"tag_transfert", uicb_tagtransfert },
{"tag_transfert_next", uicb_tagtransfert_next },

View File

@ -181,6 +181,92 @@ uicb_tag_prev(uicb_t cmd)
return;
}
/** Set the next visible tag
* \param cmd uicb_t type unused
*/
void
uicb_tag_next_visible(uicb_t cmd)
{
int i, tag;
Client *c;
Bool is_occupied[MAXTAG];
screen_get_sel();
if(!conf.tagautohide)
{
tag_set(seltag[selscreen] + 1);
return;
}
for(i = 0; i < MAXTAG; i++)
is_occupied[i] = False;
for(c = clients; c; c = c->next)
if(c->screen == selscreen)
is_occupied[c->tag] = True;
for(tag = seltag[selscreen] + 1; tag < conf.ntag[selscreen] + 1; ++tag)
if(is_occupied[tag])
{
tag_set(tag);
return;
}
if(conf.tag_round)
for(tag = 0; tag < seltag[selscreen]; ++tag)
if(is_occupied[tag])
{
tag_set(tag);
return;
}
return;
}
/** Set the prev visible tag
* \param cmd uicb_t type unused
*/
void
uicb_tag_prev_visible(uicb_t cmd)
{
int i, tag;
Client *c;
Bool is_occupied[MAXTAG];
screen_get_sel();
if(!conf.tagautohide)
{
tag_set(seltag[selscreen] - 1);
return;
}
for(i = 0; i < MAXTAG; i++)
is_occupied[i] = False;
for(c = clients; c; c = c->next)
if(c->screen == selscreen)
is_occupied[c->tag] = True;
for(tag = seltag[selscreen] - 1; tag >= 0; --tag)
if(is_occupied[tag])
{
tag_set(tag);
return;
}
if(conf.tag_round)
for(tag = conf.ntag[selscreen]; tag > seltag[selscreen]; --tag)
if(is_occupied[tag])
{
tag_set(tag);
return;
}
return;
}
/** Transfert the selected client to
* the wanted tag
* \param cmd Wanted tag, uicb_t type

View File

@ -297,6 +297,8 @@ void tag_transfert(Client *c, int tag);
void uicb_tag(uicb_t);
void uicb_tag_next(uicb_t);
void uicb_tag_prev(uicb_t);
void uicb_tag_next_visible(uicb_t);
void uicb_tag_prev_visible(uicb_t);
void uicb_tagtransfert(uicb_t);
void uicb_tag_prev_sel(uicb_t);
void uicb_tagtransfert_next(uicb_t);

View File

@ -265,6 +265,12 @@
# Select the previous tag.
[key] mod = {"Control"} key = "Left" func = "tag_prev" [/key]
# Select the next visible tag.
[key] mod = {"Control","Alt"} key = "Right" func = "tag_next_visible" [/key]
# Select the previous visible tag.
[key] mod = {"Control","Alt"} key = "Left" func = "tag_prev_visible" [/key]
# Set the next layout.
[key] mod = {"Alt"} key = "space" func = "layout_next" [/key]