mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-31 22:25:29 -04:00
feat: focusmon dispatch support mon name
This commit is contained in:
parent
ab95c110d9
commit
1bbf6adbc9
2 changed files with 17 additions and 1 deletions
|
|
@ -686,6 +686,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
||||||
} else if (strcmp(func_name, "focusmon") == 0) {
|
} else if (strcmp(func_name, "focusmon") == 0) {
|
||||||
func = focusmon;
|
func = focusmon;
|
||||||
(*arg).i = parse_direction(arg_value);
|
(*arg).i = parse_direction(arg_value);
|
||||||
|
if((*arg).i == UNDIR) {
|
||||||
|
(*arg).v = strdup(arg_value);
|
||||||
|
}
|
||||||
} else if (strcmp(func_name, "tagmon") == 0) {
|
} else if (strcmp(func_name, "tagmon") == 0) {
|
||||||
func = tagmon;
|
func = tagmon;
|
||||||
(*arg).i = parse_direction(arg_value);
|
(*arg).i = parse_direction(arg_value);
|
||||||
|
|
|
||||||
15
src/maomao.c
15
src/maomao.c
|
|
@ -4061,11 +4061,24 @@ void focusclient(Client *c, int lift) {
|
||||||
|
|
||||||
void focusmon(const Arg *arg) {
|
void focusmon(const Arg *arg) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
Monitor *m = NULL;
|
||||||
int i = 0, nmons = wl_list_length(&mons);
|
int i = 0, nmons = wl_list_length(&mons);
|
||||||
if (nmons) {
|
if (nmons && arg->i != UNDIR) {
|
||||||
do /* don't switch to disabled mons */
|
do /* don't switch to disabled mons */
|
||||||
selmon = dirtomon(arg->i);
|
selmon = dirtomon(arg->i);
|
||||||
while (!selmon->wlr_output->enabled && i++ < nmons);
|
while (!selmon->wlr_output->enabled && i++ < nmons);
|
||||||
|
} else if(arg->v) {
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
if (!m->wlr_output->enabled) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(regex_match(arg->v, m->wlr_output->name)) {
|
||||||
|
selmon = m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
warp_cursor_to_selmon(selmon);
|
warp_cursor_to_selmon(selmon);
|
||||||
c = focustop(selmon);
|
c = focustop(selmon);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue