Add "stay_last_tag" fonction/keybind

This commit is contained in:
Raphael Khaiat 2010-11-19 20:17:17 +01:00
parent 546366b282
commit f928497e70
4 changed files with 47 additions and 3 deletions

View File

@ -70,6 +70,7 @@ const func_name_list_t func_list[] =
{"tag_del", uicb_tag_del },
{"tag_rename", uicb_tag_rename },
{"tag_last", uicb_tag_last },
{"tag_stay_last", uicb_tag_stay_last },
{"set_mwfact", uicb_set_mwfact },
{"set_nmaster", uicb_set_nmaster },
{"quit", uicb_quit },
@ -500,7 +501,7 @@ conf_tag_section(void)
False, fetch_opt_first(def_tag, "false", "resizehint").bool,
False, False, bar_pos,
layout_name_to_struct(conf.layout, fetch_opt_first(def_tag, "title_right", "layout").str, conf.nlayout, layout_list),
0, NULL, 0 };
0, NULL, 0, False };
conf.default_tag = default_tag;

View File

@ -288,6 +288,7 @@ typedef struct
uint tagad;
MouseBinding *mouse;
int nmouse;
Bool stay_last;
} Tag;
/* Menu Item Struct */

View File

@ -286,11 +286,12 @@ uicb_tag_prev_visible(uicb_t cmd)
}
/** Go to the last tag
* \param cmd uicb_t type unused
*\param cmd uicb_t type unused
*/
void
uicb_tag_last(uicb_t cmd)
{
(void)cmd;
screen_get_sel();
tag_set(conf.ntag[selscreen]);
@ -298,6 +299,23 @@ uicb_tag_last(uicb_t cmd)
return;
}
/** Keep that tag the last one
*\param cmd uicb_t type unused
*/
void
uicb_tag_stay_last(uicb_t cmd)
{
/*warnx("in uicb_tag_stay_last\n");*/
(void)cmd;
screen_get_sel();
remove_old_last_tag(selscreen);
tag_set(conf.ntag[selscreen]);
return;
}
/** Transfert the selected client to
* the wanted tag
* \param cmd Wanted tag, uicb_t type
@ -538,7 +556,7 @@ tag_new(int s, char *name)
conf.default_tag.mwfact, conf.default_tag.nmaster,
False, conf.default_tag.resizehint, False, False,
conf.default_tag.barpos, conf.default_tag.layout,
0, NULL, 0 };
0, NULL, 0, False };
tags[s][conf.ntag[s]] = t;
@ -648,3 +666,25 @@ uicb_tag_rename(uicb_t cmd)
return;
}
/**
*\param selscreen int
*/
void
remove_old_last_tag(int selscreen)
{
/*warnx("in remove_old_last_tag\n");*/
/*warnx("il y a %d tag sur l ecran %d\n", conf.ntag[selscreen], selscreen);*/
int i;
for(i = 0; i < conf.ntag[selscreen]; i++)
{
/*warnx("i = %d", i);*/
if(tags[selscreen][i].stay_last)
{
tags[selscreen][i].stay_last = False;
break;
}
}
return;
}

View File

@ -331,6 +331,8 @@ void tag_delete(int s, int tag);
void uicb_tag_del(uicb_t);
void uicb_tag_rename(uicb_t cmd);
void uicb_tag_last(uicb_t cmd);
void uicb_tag_stay_last(uicb_t cmd);
void remove_old_last_tag(int selscreen);
/* screen.c */
int screen_count(void);