implement view_tagmon

Fix missing check

fix tag_mon
This commit is contained in:
reDpz 2025-10-27 17:16:28 +00:00
parent 918a00d578
commit 35c9b3ea48
3 changed files with 57 additions and 1 deletions

View file

@ -1004,6 +1004,10 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
func = bind_to_view; func = bind_to_view;
(*arg).ui = 1 << (atoi(arg_value) - 1); (*arg).ui = 1 << (atoi(arg_value) - 1);
(*arg).i = atoi(arg_value2); (*arg).i = atoi(arg_value2);
} else if (strcmp(func_name, "view_tagmon") == 0) {
func = view_tagmon;
(*arg).ui = 1 << (atoi(arg_value) - 1);
(*arg).v = strdup(arg_value2);
} else if (strcmp(func_name, "toggletag") == 0) { } else if (strcmp(func_name, "toggletag") == 0) {
func = toggletag; func = toggletag;
(*arg).ui = 1 << (atoi(arg_value) - 1); (*arg).ui = 1 << (atoi(arg_value) - 1);

View file

@ -64,4 +64,5 @@ int create_virtual_output(const Arg *arg);
int destroy_all_virtual_output(const Arg *arg); int destroy_all_virtual_output(const Arg *arg);
int focuslast(const Arg *arg); int focuslast(const Arg *arg);
int toggle_trackpad_enable(const Arg *arg); int toggle_trackpad_enable(const Arg *arg);
int setoption(const Arg *arg); int view_tagmon(const Arg *arg);
int setoption(const Arg *arg);

View file

@ -1546,3 +1546,54 @@ int toggleoverview(const Arg *arg) {
refresh_monitors_workspaces_status(selmon); refresh_monitors_workspaces_status(selmon);
return 0; return 0;
} }
int view_tagmon(const Arg *arg) {
Client *c = NULL, *old_selmon_sel = NULL;
Monitor *m = NULL;
int _warpcursor = warpcursor;
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)) {
break;
}
}
} else {
return 0;
}
if (!m || !m->wlr_output->enabled)
return 0;
if (selmon == m) {
// Don't warp cursor if already at monitor
_warpcursor = 0;
}
old_selmon_sel = selmon->sel;
selmon = m;
if (_warpcursor) {
warp_cursor_to_selmon(selmon);
}
c = focustop(selmon);
if (!c) {
selmon->sel = NULL;
wlr_seat_pointer_notify_clear_focus(seat);
wlr_seat_keyboard_notify_clear_focus(seat);
} else
focusclient(c, 1);
if (old_selmon_sel) {
setborder_color(old_selmon_sel);
}
Arg v_arg;
// Set the tag bitmask
v_arg.ui = arg->ui;
// default value?
v_arg.i = 0;
return bind_to_view(&v_arg);
}