mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-12 05:34:32 -04:00
feat: monitor arg support multi spec match in disptach
This commit is contained in:
parent
43d0f0f54a
commit
6667708d9a
3 changed files with 76 additions and 6 deletions
|
|
@ -210,7 +210,7 @@ int32_t focusmon(const Arg *arg) {
|
|||
if (!m->wlr_output->enabled) {
|
||||
continue;
|
||||
}
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
tm = m;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1102,7 +1102,7 @@ int32_t tagmon(const Arg *arg) {
|
|||
if (!cm->wlr_output->enabled) {
|
||||
continue;
|
||||
}
|
||||
if (regex_match(arg->v, cm->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, cm)) {
|
||||
m = cm;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1543,7 +1543,7 @@ int32_t tagcrossmon(const Arg *arg) {
|
|||
if (!selmon || !selmon->sel)
|
||||
return 0;
|
||||
|
||||
if (regex_match(selmon->wlr_output->name, arg->v)) {
|
||||
if (match_monitor_spec(arg->v, selmon)) {
|
||||
tag_client(arg, selmon->sel);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1701,7 +1701,7 @@ int32_t disable_monitor(const Arg *arg) {
|
|||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, false);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
m->asleep = 1;
|
||||
|
|
@ -1716,7 +1716,7 @@ int32_t enable_monitor(const Arg *arg) {
|
|||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, true);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
m->asleep = 0;
|
||||
|
|
@ -1731,7 +1731,7 @@ int32_t toggle_monitor(const Arg *arg) {
|
|||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, !m->wlr_output->enabled);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
m->asleep = !m->wlr_output->enabled;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue