diff --git a/src/config.c b/src/config.c index e9760bf..9b4a164 100644 --- a/src/config.c +++ b/src/config.c @@ -63,7 +63,8 @@ static cfg_opt_t bar_opts[] = static cfg_opt_t mouse_button_opts[] = { - CFG_INT("tag", 0, CFGF_NONE), + CFG_INT("tag", -1, CFGF_NONE), + CFG_INT("screen", 0, CFGF_NONE), CFG_STR("button", "Button1", CFGF_NONE), CFG_STR("func", "", CFGF_NONE), CFG_STR("cmd", "", CFGF_NONE), @@ -323,6 +324,7 @@ mouse_section(MouseBinding mb[], cfg_t *cfg, int ns) { tmp = cfg_getnsec(cfg, "mouse", i); mb[i].tag = cfg_getint(tmp, "tag"); + mb[i].screen = cfg_getint(tmp, "screen"); mb[i].button = char_to_button(cfg_getstr(tmp, "button")); mb[i].func = name_to_func(cfg_getstr(tmp, "func"), func_list); mb[i].cmd = strdup(alias_to_str(cfg_getstr(tmp, "cmd"))); diff --git a/src/event.c b/src/event.c index 55087d8..562687e 100644 --- a/src/event.c +++ b/src/event.c @@ -65,7 +65,7 @@ buttonpress(XButtonEvent *ev) /* Root */ if(ev->window == root) for(i = 0; i < conf.root.nmouse; ++i) - if(conf.root.mouse[i].tag == seltag[screen_get_sel()] + if(conf.root.mouse[i].tag == seltag[conf.root.mouse[i].screen] || conf.root.mouse[i].tag < 0) if(ev->button == conf.root.mouse[i].button) if(conf.root.mouse[i].func) diff --git a/src/structs.h b/src/structs.h index 2593fe2..aeb73d7 100644 --- a/src/structs.h +++ b/src/structs.h @@ -124,6 +124,7 @@ typedef struct typedef struct { int tag; + int screen; uint button; void (*func)(uicb_t); uicb_t cmd;