feat: focusmon dispatch support mon name

This commit is contained in:
DreamMaoMao 2025-06-14 15:59:41 +08:00
parent ab95c110d9
commit 1bbf6adbc9
2 changed files with 17 additions and 1 deletions

View file

@ -4061,11 +4061,24 @@ void focusclient(Client *c, int lift) {
void focusmon(const Arg *arg) {
Client *c;
Monitor *m = NULL;
int i = 0, nmons = wl_list_length(&mons);
if (nmons) {
if (nmons && arg->i != UNDIR) {
do /* don't switch to disabled mons */
selmon = dirtomon(arg->i);
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);
c = focustop(selmon);