diff --git a/src/config/parse_config.h b/src/config/parse_config.h index eeabc8b..29d5c8b 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -726,15 +726,19 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, func = switch_proportion_preset; } else if (strcmp(func_name, "viewtoleft") == 0) { func = viewtoleft; + (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "viewtoright") == 0) { func = viewtoright; + (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "tagsilent") == 0) { func = tagsilent; (*arg).ui = 1 << (atoi(arg_value) - 1); } else if (strcmp(func_name, "tagtoleft") == 0) { func = tagtoleft; + (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "tagtoright") == 0) { func = tagtoright; + (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "killclient") == 0) { func = killclient; } else if (strcmp(func_name, "centerwin") == 0) { @@ -810,16 +814,20 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, func = togglemaxmizescreen; } else if (strcmp(func_name, "viewtoleft_have_client") == 0) { func = viewtoleft_have_client; + (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "viewtoright_have_client") == 0) { func = viewtoright_have_client; + (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "reload_config") == 0) { func = reload_config; } else if (strcmp(func_name, "tag") == 0) { func = tag; (*arg).ui = 1 << (atoi(arg_value) - 1); + (*arg).i = atoi(arg_value2); } else if (strcmp(func_name, "view") == 0) { func = bind_to_view; (*arg).ui = 1 << (atoi(arg_value) - 1); + (*arg).i = atoi(arg_value2); } else if (strcmp(func_name, "toggletag") == 0) { func = toggletag; (*arg).ui = 1 << (atoi(arg_value) - 1); @@ -1699,9 +1707,9 @@ void parse_config_line(Config *config, const char *line) { memset(binding, 0, sizeof(KeyBinding)); char mod_str[256], keysym_str[256], func_name[256], - arg_value[256] = "none", arg_value2[256] = "none", - arg_value3[256] = "none", arg_value4[256] = "none", - arg_value5[256] = "none"; + arg_value[256] = "0\0", arg_value2[256] = "0\0", + arg_value3[256] = "0\0", arg_value4[256] = "0\0", + arg_value5[256] = "0\0"; if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str, keysym_str, func_name, arg_value, arg_value2, arg_value3, arg_value4, arg_value5) < 3) { @@ -1758,9 +1766,9 @@ void parse_config_line(Config *config, const char *line) { memset(binding, 0, sizeof(MouseBinding)); char mod_str[256], button_str[256], func_name[256], - arg_value[256] = "none", arg_value2[256] = "none", - arg_value3[256] = "none", arg_value4[256] = "none", - arg_value5[256] = "none"; + arg_value[256] = "0\0", arg_value2[256] = "0\0", + arg_value3[256] = "0\0", arg_value4[256] = "0\0", + arg_value5[256] = "0\0"; if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str, button_str, func_name, arg_value, arg_value2, arg_value3, arg_value4, arg_value5) < 3) { @@ -1817,9 +1825,9 @@ void parse_config_line(Config *config, const char *line) { memset(binding, 0, sizeof(AxisBinding)); char mod_str[256], dir_str[256], func_name[256], - arg_value[256] = "none", arg_value2[256] = "none", - arg_value3[256] = "none", arg_value4[256] = "none", - arg_value5[256] = "none"; + arg_value[256] = "0\0", arg_value2[256] = "0\0", + arg_value3[256] = "0\0", arg_value4[256] = "0\0", + arg_value5[256] = "0\0"; if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str, dir_str, func_name, arg_value, arg_value2, arg_value3, arg_value4, arg_value5) < 3) { @@ -1879,9 +1887,9 @@ void parse_config_line(Config *config, const char *line) { memset(binding, 0, sizeof(SwitchBinding)); char fold_str[256], func_name[256], - arg_value[256] = "none", arg_value2[256] = "none", - arg_value3[256] = "none", arg_value4[256] = "none", - arg_value5[256] = "none"; + arg_value[256] = "0\0", arg_value2[256] = "0\0", + arg_value3[256] = "0\0", arg_value4[256] = "0\0", + arg_value5[256] = "0\0"; if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", fold_str, func_name, arg_value, arg_value2, arg_value3, arg_value4, arg_value5) < 3) { @@ -1935,9 +1943,9 @@ void parse_config_line(Config *config, const char *line) { memset(binding, 0, sizeof(GestureBinding)); char mod_str[256], motion_str[256], fingers_count_str[256], - func_name[256], arg_value[256] = "none", arg_value2[256] = "none", - arg_value3[256] = "none", arg_value4[256] = "none", - arg_value5[256] = "none"; + func_name[256], arg_value[256] = "0\0", arg_value2[256] = "0\0", + arg_value3[256] = "0\0", arg_value4[256] = "0\0", + arg_value5[256] = "0\0"; if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str, motion_str, fingers_count_str, func_name, arg_value, diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 80ce042..a2e4e79 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -18,9 +18,9 @@ void bind_to_view(const Arg *arg) { } if (target == 0 || (int)target == INT_MIN) { - view(&(Arg){.ui = ~0 & TAGMASK}, false); + view(&(Arg){.ui = ~0 & TAGMASK, .i = arg->i}, false); } else { - view(&(Arg){.ui = target}, true); + view(&(Arg){.ui = target, .i = arg->i}, true); } } @@ -129,8 +129,8 @@ void toggle_trackpad_enable(const Arg *arg) { } void focusmon(const Arg *arg) { - Client *c; Monitor *m = NULL; + Client *c; if (arg->i != UNDIR) { m = dirtomon(arg->i); @@ -956,13 +956,13 @@ void tagmon(const Arg *arg) { if (c->isfloating) { c->geom = c->float_geom; target = get_tags_first_tag(c->tags); - view(&(Arg){.ui = target}, true); + view(&(Arg){.ui = target, .i = arg->i}, true); focusclient(c, 1); resize(c, c->geom, 1); } else { selmon = c->mon; target = get_tags_first_tag(c->tags); - view(&(Arg){.ui = target}, true); + view(&(Arg){.ui = target, .i = arg->i}, true); focusclient(c, 1); arrange(selmon, false); } @@ -992,7 +992,7 @@ void tagtoleft(const Arg *arg) { if (selmon->sel != NULL && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && selmon->tagset[selmon->seltags] > 1) { - tag(&(Arg){.ui = selmon->tagset[selmon->seltags] >> 1}); + tag(&(Arg){.ui = selmon->tagset[selmon->seltags] >> 1, .i = arg->i}); } } @@ -1000,7 +1000,7 @@ void tagtoright(const Arg *arg) { if (selmon->sel != NULL && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { - tag(&(Arg){.ui = selmon->tagset[selmon->seltags] << 1}); + tag(&(Arg){.ui = selmon->tagset[selmon->seltags] << 1, .i = arg->i}); } } @@ -1194,7 +1194,7 @@ void viewtoleft(const Arg *arg) { if (!selmon || (target) == selmon->tagset[selmon->seltags]) return; - view(&(Arg){.ui = target & TAGMASK}, true); + view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true); } void viewtoright(const Arg *arg) { if (selmon->isoverview || selmon->pertag->curtag == 0) { @@ -1209,7 +1209,7 @@ void viewtoright(const Arg *arg) { return; } - view(&(Arg){.ui = target & TAGMASK}, true); + view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true); } void viewtoleft_have_client(const Arg *arg) { @@ -1233,7 +1233,7 @@ void viewtoleft_have_client(const Arg *arg) { } if (found) - view(&(Arg){.ui = (1 << (n - 1)) & TAGMASK}, true); + view(&(Arg){.ui = (1 << (n - 1)) & TAGMASK, .i = arg->i}, true); } void viewtoright_have_client(const Arg *arg) { @@ -1257,7 +1257,7 @@ void viewtoright_have_client(const Arg *arg) { } if (found) - view(&(Arg){.ui = (1 << (n - 1)) & TAGMASK}, true); + view(&(Arg){.ui = (1 << (n - 1)) & TAGMASK, .i = arg->i}, true); } void zoom(const Arg *arg) { diff --git a/src/ext-protocol/dwl-ipc.h b/src/ext-protocol/dwl-ipc.h index b894a41..941f879 100644 --- a/src/ext-protocol/dwl-ipc.h +++ b/src/ext-protocol/dwl-ipc.h @@ -262,7 +262,7 @@ void dwl_ipc_output_set_tags(struct wl_client *client, return; monitor = ipc_output->mon; - view_in_mon(&(Arg){.ui = newtags}, true, monitor); + view_in_mon(&(Arg){.ui = newtags}, true, monitor, true); } void dwl_ipc_output_quit(struct wl_client *client, diff --git a/src/mango.c b/src/mango.c index 67447b5..cfc26ad 100644 --- a/src/mango.c +++ b/src/mango.c @@ -654,7 +654,8 @@ static void scene_buffer_apply_opacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *data); static Client *direction_select(const Arg *arg); -static void view_in_mon(const Arg *arg, bool want_animation, Monitor *m); +static void view_in_mon(const Arg *arg, bool want_animation, Monitor *m, + bool changefocus); static void buffer_set_effect(Client *c, BufferData buffer_data); static void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, @@ -1236,7 +1237,7 @@ void applyrules(Client *c) { !(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags]) && !c->isopensilent && !c->istagsilent) { c->animation.tag_from_rule = true; - view_in_mon(&(Arg){.ui = c->tags}, true, c->mon); + view_in_mon(&(Arg){.ui = c->tags}, true, c->mon, true); } setfullscreen(c, fullscreen_state_backup); @@ -4945,7 +4946,7 @@ void tag_client(const Arg *arg, Client *target_client) { clear_fullscreen_flag(fc); } } - view(&(Arg){.ui = arg->ui}, false); + view(&(Arg){.ui = arg->ui, .i = arg->i}, false); } else { view(arg, false); @@ -5395,7 +5396,8 @@ urgent(struct wl_listener *listener, void *data) { } } -void view_in_mon(const Arg *arg, bool want_animation, Monitor *m) { +void view_in_mon(const Arg *arg, bool want_animation, Monitor *m, + bool changefocus) { unsigned int i, tmptag; if (!m || (arg->ui != (~0 & TAGMASK) && m->isoverview)) { @@ -5442,13 +5444,25 @@ void view_in_mon(const Arg *arg, bool want_animation, Monitor *m) { toggleseltags: - focusclient(focustop(m), 1); + if (changefocus) + focusclient(focustop(m), 1); arrange(m, want_animation); printstatus(); } void view(const Arg *arg, bool want_animation) { - view_in_mon(arg, want_animation, selmon); + Monitor *m, *record_mon; + if (arg->i) { + record_mon = selmon; + view_in_mon(arg, want_animation, record_mon, true); + wl_list_for_each(m, &mons, link) { + if (!m->wlr_output->enabled || m == record_mon) + continue; + view_in_mon(arg, want_animation, m, false); + } + } else { + view_in_mon(arg, want_animation, selmon, true); + } } void virtualkeyboard(struct wl_listener *listener, void *data) {