mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
feat: tag action sync all monitor
This commit is contained in:
parent
1dc2b51250
commit
47d24d6e8a
5 changed files with 76 additions and 54 deletions
48
config.conf
48
config.conf
|
|
@ -183,35 +183,35 @@ bind=ALT,x,switch_proportion_preset,
|
|||
bind=SUPER,n,switch_layout
|
||||
|
||||
# tag switch
|
||||
bind=SUPER,Left,viewtoleft,
|
||||
bind=CTRL,Left,viewtoleft_have_client,
|
||||
bind=SUPER,Right,viewtoright,
|
||||
bind=CTRL,Right,viewtoright_have_client,
|
||||
bind=CTRL+SUPER,Left,tagtoleft,
|
||||
bind=CTRL+SUPER,Right,tagtoright,
|
||||
bind=SUPER,Left,viewtoleft,0
|
||||
bind=CTRL,Left,viewtoleft_have_client,0
|
||||
bind=SUPER,Right,viewtoright,0
|
||||
bind=CTRL,Right,viewtoright_have_client,0
|
||||
bind=CTRL+SUPER,Left,tagtoleft,0
|
||||
bind=CTRL+SUPER,Right,tagtoright,0
|
||||
|
||||
bind=Ctrl,1,view,1
|
||||
bind=Ctrl,2,view,2
|
||||
bind=Ctrl,3,view,3
|
||||
bind=Ctrl,4,view,4
|
||||
bind=Ctrl,5,view,5
|
||||
bind=Ctrl,6,view,6
|
||||
bind=Ctrl,7,view,7
|
||||
bind=Ctrl,8,view,8
|
||||
bind=Ctrl,9,view,9
|
||||
bind=Ctrl,1,view,1,0
|
||||
bind=Ctrl,2,view,2,0
|
||||
bind=Ctrl,3,view,3,0
|
||||
bind=Ctrl,4,view,4,0
|
||||
bind=Ctrl,5,view,5,0
|
||||
bind=Ctrl,6,view,6,0
|
||||
bind=Ctrl,7,view,7,0
|
||||
bind=Ctrl,8,view,8,0
|
||||
bind=Ctrl,9,view,9,0
|
||||
|
||||
# tag: move client to the tag and focus it
|
||||
# tagsilent: move client to the tag and not focus it
|
||||
# bind=Alt,1,tagsilent,1
|
||||
bind=Alt,1,tag,1
|
||||
bind=Alt,2,tag,2
|
||||
bind=Alt,3,tag,3
|
||||
bind=Alt,4,tag,4
|
||||
bind=Alt,5,tag,5
|
||||
bind=Alt,6,tag,6
|
||||
bind=Alt,7,tag,7
|
||||
bind=Alt,8,tag,8
|
||||
bind=Alt,9,tag,9
|
||||
bind=Alt,1,tag,1,0
|
||||
bind=Alt,2,tag,2,0
|
||||
bind=Alt,3,tag,3,0
|
||||
bind=Alt,4,tag,4,0
|
||||
bind=Alt,5,tag,5,0
|
||||
bind=Alt,6,tag,6,0
|
||||
bind=Alt,7,tag,7,0
|
||||
bind=Alt,8,tag,8,0
|
||||
bind=Alt,9,tag,9,0
|
||||
|
||||
# monitor switch
|
||||
bind=alt+shift,Left,focusmon,left
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
26
src/mango.c
26
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue