Tag: Add multitag support (Feature #38 requested by Chacha^Wmarkand): button 3 click on tag to add it. (tagtransfert is now button 2 by default)
This commit is contained in:
parent
e920b99951
commit
5c439c245c
@ -430,7 +430,8 @@ client_hide(Client *c)
|
||||
Bool
|
||||
ishide(Client *c, int screen)
|
||||
{
|
||||
if(c->tag == seltag[screen] && c->screen == screen)
|
||||
if((c->tag == seltag[screen] && c->screen == screen)
|
||||
|| tags[screen][seltag[screen]].tagad & TagFlag(c->tag))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
|
||||
23
src/config.c
23
src/config.c
@ -58,6 +58,7 @@ func_name_list_t tmp_func_list[] =
|
||||
{"tag_transfert_next", uicb_tagtransfert_next },
|
||||
{"tag_transfert_prev", uicb_tagtransfert_prev },
|
||||
{"tag_urgent", uicb_tag_urgent },
|
||||
{"tag_toggle_additional", uicb_tag_toggle_additional },
|
||||
{"set_mwfact", uicb_set_mwfact },
|
||||
{"set_nmaster", uicb_set_nmaster },
|
||||
{"quit", uicb_quit },
|
||||
@ -398,7 +399,8 @@ conf_tag_section(char *src)
|
||||
*/
|
||||
Tag default_tag = { "WMFS", NULL, 0, 1,
|
||||
0.50, 1, False, False, False, False, IB_Top,
|
||||
layout_name_to_struct(conf.layout, "tile_right", conf.nlayout, layout_list) };
|
||||
layout_name_to_struct(conf.layout, "tile_right", conf.nlayout, layout_list),
|
||||
0, NULL, 0 };
|
||||
|
||||
cfg_set_sauv(src);
|
||||
|
||||
@ -410,6 +412,18 @@ conf_tag_section(char *src)
|
||||
conf.colors.tag_occupied_bg = getcolor(get_opt(src, "#222222", "occupied_bg").str);
|
||||
conf.border.tag = get_opt(src, "false", "border").bool;
|
||||
|
||||
/* Mouse button action on tag */
|
||||
conf.mouse_tag_action[TagSel] =
|
||||
char_to_button(get_opt(src, "1", "mouse_button_tag_sel").str, mouse_button_list);
|
||||
conf.mouse_tag_action[TagTransfert] =
|
||||
char_to_button(get_opt(src, "2", "mouse_button_tag_transfert").str, mouse_button_list);
|
||||
conf.mouse_tag_action[TagAdd] =
|
||||
char_to_button(get_opt(src, "3", "mouse_button_tag_add").str, mouse_button_list);
|
||||
conf.mouse_tag_action[TagNext] =
|
||||
char_to_button(get_opt(src, "4", "mouse_button_tag_next").str, mouse_button_list);
|
||||
conf.mouse_tag_action[TagPrev] =
|
||||
char_to_button(get_opt(src, "5", "mouse_button_tag_prev").str, mouse_button_list);
|
||||
|
||||
sc = screen_count();
|
||||
|
||||
/* Alloc all */
|
||||
@ -471,6 +485,13 @@ conf_tag_section(char *src)
|
||||
tags[k][conf.ntag[k]].clients[m] = (buf[m].str) ? buf[m].str : NULL;
|
||||
}
|
||||
|
||||
/* Multi mouse sections */
|
||||
if((tags[k][conf.ntag[k]].nmouse = get_size_sec(cfgtmp, "mouse")))
|
||||
{
|
||||
tags[k][conf.ntag[k]].mouse = emalloc(tags[k][conf.ntag[k]].nmouse, sizeof(MouseBinding));
|
||||
mouse_section(tags[k][conf.ntag[k]].mouse, cfgtmp, tags[k][conf.ntag[k]].nmouse);
|
||||
}
|
||||
|
||||
}
|
||||
l = 0;
|
||||
cfg_set_sauv(src);
|
||||
|
||||
25
src/event.c
25
src/event.c
@ -99,13 +99,24 @@ buttonpress(XButtonEvent *ev)
|
||||
/* Tags */
|
||||
for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
|
||||
if(ev->window == infobar[selscreen].tags[i]->win)
|
||||
switch(ev->button)
|
||||
{
|
||||
case Button1: tag_set(i); break;
|
||||
case Button3: tag_transfert(sel, i); break;
|
||||
case Button4: tag_set(seltag[selscreen] + 1); break;
|
||||
case Button5: tag_set(seltag[selscreen] - 1); break;
|
||||
}
|
||||
{
|
||||
for(j = 0; j < tags[selscreen][i].nmouse; ++j)
|
||||
if(ev->button == tags[selscreen][i].mouse[j].button)
|
||||
if(tags[selscreen][i].mouse[j].func)
|
||||
tags[selscreen][i].mouse[j].func(tags[selscreen][i].mouse[j].cmd);
|
||||
|
||||
/* Mouse button action on tag */
|
||||
if(ev->button == conf.mouse_tag_action[TagSel])
|
||||
tag_set(i);
|
||||
else if(ev->button == conf.mouse_tag_action[TagTransfert])
|
||||
tag_transfert(sel, i);
|
||||
else if(ev->button == conf.mouse_tag_action[TagAdd])
|
||||
tag_additional(selscreen, seltag[selscreen], i);
|
||||
else if(ev->button == conf.mouse_tag_action[TagNext])
|
||||
tag_set(seltag[selscreen] + 1);
|
||||
else if(ev->button == conf.mouse_tag_action[TagPrev])
|
||||
tag_set(seltag[selscreen] - 1);
|
||||
}
|
||||
|
||||
/* Layout button */
|
||||
if(ev->window == infobar[selscreen].layout_button->win && conf.nlayout > 1)
|
||||
|
||||
@ -203,8 +203,15 @@ infobar_draw_taglist(int sc)
|
||||
|
||||
for(i = 1; i < conf.ntag[sc] + 1; ++i)
|
||||
{
|
||||
infobar[sc].tags[i]->bg = ((i == seltag[sc]) ? conf.colors.tagselbg : conf.colors.bar);
|
||||
infobar[sc].tags[i]->fg = ((i == seltag[sc]) ? conf.colors.tagselfg : conf.colors.text);
|
||||
infobar[sc].tags[i]->bg =
|
||||
((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))
|
||||
? conf.colors.tagselbg
|
||||
: conf.colors.bar);
|
||||
|
||||
infobar[sc].tags[i]->fg =
|
||||
((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))
|
||||
? conf.colors.tagselfg
|
||||
: conf.colors.text);
|
||||
|
||||
barwin_refresh_color(infobar[sc].tags[i]);
|
||||
|
||||
@ -213,7 +220,11 @@ infobar_draw_taglist(int sc)
|
||||
{
|
||||
if(c->screen == sc)
|
||||
{
|
||||
infobar[sc].tags[c->tag]->bg = ((c->tag == seltag[sc]) ? conf.colors.tagselbg : conf.colors.tag_occupied_bg);
|
||||
infobar[sc].tags[c->tag]->bg =
|
||||
((c->tag == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(c->tag)))
|
||||
? conf.colors.tagselbg
|
||||
: conf.colors.tag_occupied_bg;
|
||||
|
||||
barwin_refresh_color(infobar[sc].tags[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,6 +51,8 @@
|
||||
#define AboveFlag (1 << 9)
|
||||
#define UrgentFlag (1 << 10)
|
||||
|
||||
#define TagFlag(t) (1 << (t))
|
||||
|
||||
/* XEMBED messages */
|
||||
#define XEMBED_MAPPED (1 << 0)
|
||||
#define XEMBED_EMBEDDED_NOTIFY 0
|
||||
@ -82,13 +84,13 @@ typedef unsigned char uchar;
|
||||
|
||||
/* Enum */
|
||||
enum { CurNormal, CurResize, CurRightResize, CurLeftResize, CurMove, CurLast };
|
||||
enum { TagSel, TagTransfert, TagAdd, TagNext, TagPrev, TagActionLast };
|
||||
|
||||
/* Infobar position */
|
||||
enum { IB_Hide = 0, IB_Bottom = 1, IB_Top = 2 };
|
||||
|
||||
typedef enum { Right, Left, Top, Bottom, Center, PositionLast } Position;
|
||||
|
||||
|
||||
/* Ewmh hints list */
|
||||
enum
|
||||
{
|
||||
@ -257,6 +259,9 @@ typedef struct
|
||||
Bool abovefc;
|
||||
int barpos;
|
||||
Layout layout;
|
||||
uint tagad;
|
||||
MouseBinding *mouse;
|
||||
int nmouse;
|
||||
} Tag;
|
||||
|
||||
/* Menu Item Struct */
|
||||
@ -400,6 +405,7 @@ typedef struct
|
||||
Bool layout;
|
||||
} border;
|
||||
Alias alias[256];
|
||||
uint mouse_tag_action[TagActionLast];
|
||||
Layout layout[NUM_OF_LAYOUT];
|
||||
Menu *menu;
|
||||
Launcher *launcher;
|
||||
|
||||
35
src/tag.c
35
src/tag.c
@ -250,3 +250,38 @@ uicb_tag_urgent(uicb_t cmd)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Add a additional tag to the current tag
|
||||
*\param sc Screen
|
||||
*\param tag Tag where apply additional tag
|
||||
*\param adtag Additional tag to apply in tag
|
||||
*/
|
||||
void
|
||||
tag_additional(int sc, int tag, int adtag)
|
||||
{
|
||||
if(tag < 0 || tag > conf.ntag[sc]
|
||||
|| adtag < 1 || adtag > conf.ntag[sc] || adtag == seltag[sc])
|
||||
return;
|
||||
|
||||
tags[sc][tag].tagad ^= TagFlag(adtag);
|
||||
tags[sc][adtag].request_update = True;
|
||||
arrange(sc, True);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Add a additional tag to the current tag
|
||||
*\param cmd uicb_t
|
||||
*/
|
||||
void
|
||||
uicb_tag_toggle_additional(uicb_t cmd)
|
||||
{
|
||||
screen_get_sel();
|
||||
|
||||
tag_additional(selscreen, seltag[selscreen], atoi(cmd));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -289,6 +289,9 @@ void uicb_tag_prev_sel(uicb_t);
|
||||
void uicb_tagtransfert_next(uicb_t);
|
||||
void uicb_tagtransfert_prev(uicb_t);
|
||||
void uicb_tag_urgent(uicb_t cmd);
|
||||
void tag_additional(int sc, int tag, int adtag);
|
||||
void uicb_tag_toggle_additional(uicb_t cmd);
|
||||
|
||||
|
||||
/* screen.c */
|
||||
int screen_count(void);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user