mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-05 06:47:12 -04:00
impl comboview_spawn_on_empty
This commit is contained in:
parent
64d8764f58
commit
e1dc0c5b61
3 changed files with 38 additions and 2 deletions
|
|
@ -1014,6 +1014,10 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
func = spawn_on_empty;
|
||||
(*arg).v = strdup(arg_value); // 注意:之后需要释放这个内存
|
||||
(*arg).ui = 1 << (atoi(arg_value2) - 1);
|
||||
} else if (strcmp(func_name, "comboview_spawn_on_empty") == 0) {
|
||||
func = comboview_spawn_on_empty;
|
||||
(*arg).v = strdup(arg_value); // 注意:之后需要释放这个内存
|
||||
(*arg).ui = 1 << (atoi(arg_value2) - 1);
|
||||
} else if (strcmp(func_name, "quit") == 0) {
|
||||
func = quit;
|
||||
} else if (strcmp(func_name, "create_virtual_output") == 0) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ int tagmon(const Arg *arg);
|
|||
int spawn(const Arg *arg);
|
||||
int spawn_shell(const Arg *arg);
|
||||
int spawn_on_empty(const Arg *arg);
|
||||
int comboview_spawn_on_empty(const Arg *arg);
|
||||
int setkeymode(const Arg *arg);
|
||||
int switch_keyboard_layout(const Arg *arg);
|
||||
int setlayout(const Arg *arg);
|
||||
|
|
@ -68,4 +69,4 @@ int toggle_trackpad_enable(const Arg *arg);
|
|||
int setoption(const Arg *arg);
|
||||
int disable_monitor(const Arg *arg);
|
||||
int enable_monitor(const Arg *arg);
|
||||
int toggle_monitor(const Arg *arg);
|
||||
int toggle_monitor(const Arg *arg);
|
||||
|
|
|
|||
|
|
@ -810,6 +810,37 @@ int spawn_on_empty(const Arg *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
comboview_spawn_on_empty(const Arg *arg) {
|
||||
unsigned int newtags = arg->ui & TAGMASK;
|
||||
bool is_empty = true;
|
||||
Client *c = NULL;
|
||||
|
||||
if (!newtags || !selmon)
|
||||
return 0;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (arg->ui & c->tags && c->mon == selmon) {
|
||||
is_empty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tag_combo) {
|
||||
selmon->tagset[selmon->seltags] |= newtags;
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon, false);
|
||||
} else {
|
||||
tag_combo = true;
|
||||
view(&(Arg){.ui = newtags}, false);
|
||||
}
|
||||
if (is_empty) {
|
||||
spawn(arg);
|
||||
}
|
||||
|
||||
printstatus();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int switch_keyboard_layout(const Arg *arg) {
|
||||
if (!kb_group || !kb_group->wlr_group || !seat) {
|
||||
wlr_log(WLR_ERROR, "Invalid keyboard group or seat");
|
||||
|
|
@ -1548,4 +1579,4 @@ int toggle_monitor(const Arg *arg) {
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue