mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-28 13:14:16 -04:00
feat: distinguish dpms dispatch and disable dispatch in monitor
This commit is contained in:
parent
171d859cb5
commit
b0326d710c
5 changed files with 68 additions and 12 deletions
|
|
@ -177,11 +177,12 @@ bindr=Super,Super_L,spawn,rofi -show run
|
|||
| `setkeymode` | `mode` | Set keymode. |
|
||||
| `switch_keyboard_layout` | `[index]` | Switch keyboard layout. Optional index (0, 1, 2...) to switch to specific layout. |
|
||||
| `setoption` | `key,value` | Set config option temporarily. |
|
||||
| `disable_monitor` | `monitor_spec` | Shutdown monitor. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `enable_monitor` | `monitor_spec` | Power on monitor. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `toggle_monitor` | `monitor_spec` | Toggle monitor power. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `chvt` | `1-9` | Change virtual terminal (tty, equivalent to using ctrl+alt+Fkeys) |
|
||||
|
||||
| `dpms_off_monitor` | `monitor_spec` | Shutdown monitor power but not remove. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `dpms_on_monitor` | `monitor_spec` | Turn on monitor power. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `dpms_toggle_monitor` | `monitor_spec` | Toggle monitor power but not remove. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format).
|
||||
| `disable_monitor` | `monitor_spec` | remove monitor. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `enable_monitor` | `monitor_spec` | add monitor. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
| `toggle_monitor` | `monitor_spec` | Toggle monitor add/remove. Accepts a [monitor spec](/docs/configuration/monitors#monitor-spec-format). |
|
||||
|
||||
### Media Controls
|
||||
|
||||
|
|
|
|||
|
|
@ -1296,6 +1296,15 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
} else if (strcmp(func_name, "toggle_monitor") == 0) {
|
||||
func = toggle_monitor;
|
||||
(*arg).v = strdup(arg_value);
|
||||
} else if (strcmp(func_name, "dpms_off_monitor") == 0) {
|
||||
func = dpms_off_monitor;
|
||||
(*arg).v = strdup(arg_value);
|
||||
} else if (strcmp(func_name, "dpms_on_monitor") == 0) {
|
||||
func = dpms_on_monitor;
|
||||
(*arg).v = strdup(arg_value);
|
||||
} else if (strcmp(func_name, "dpms_toggle_monitor") == 0) {
|
||||
func = dpms_toggle_monitor;
|
||||
(*arg).v = strdup(arg_value);
|
||||
} else if (strcmp(func_name, "scroller_stack") == 0) {
|
||||
func = scroller_stack;
|
||||
(*arg).i = parse_direction(arg_value);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ int32_t setoption(const Arg *arg);
|
|||
int32_t disable_monitor(const Arg *arg);
|
||||
int32_t enable_monitor(const Arg *arg);
|
||||
int32_t toggle_monitor(const Arg *arg);
|
||||
int32_t dpms_off_monitor(const Arg *arg);
|
||||
int32_t dpms_on_monitor(const Arg *arg);
|
||||
int32_t dpms_toggle_monitor(const Arg *arg);
|
||||
int32_t scroller_stack(const Arg *arg);
|
||||
int32_t toggle_all_floating(const Arg *arg);
|
||||
int32_t dwindle_toggle_split_direction(const Arg *arg);
|
||||
|
|
|
|||
|
|
@ -1949,7 +1949,7 @@ int32_t disable_monitor(const Arg *arg) {
|
|||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&m->pending, false);
|
||||
mango_output_commit(m);
|
||||
m->asleep = 1;
|
||||
m->only_dpms_off = 0;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1963,7 +1963,7 @@ int32_t enable_monitor(const Arg *arg) {
|
|||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&m->pending, true);
|
||||
mango_output_commit(m);
|
||||
m->asleep = 0;
|
||||
m->only_dpms_off = 0;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1977,7 +1977,50 @@ int32_t toggle_monitor(const Arg *arg) {
|
|||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&m->pending, !m->wlr_output->enabled);
|
||||
mango_output_commit(m);
|
||||
m->asleep = !m->wlr_output->enabled;
|
||||
m->only_dpms_off = 0;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t dpms_off_monitor(const Arg *arg) {
|
||||
Monitor *m = NULL;
|
||||
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&m->pending, false);
|
||||
mango_output_commit(m);
|
||||
m->only_dpms_off = 1;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t dpms_on_monitor(const Arg *arg) {
|
||||
Monitor *m = NULL;
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&m->pending, true);
|
||||
mango_output_commit(m);
|
||||
m->only_dpms_off = 0;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t dpms_toggle_monitor(const Arg *arg) {
|
||||
Monitor *m = NULL;
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&m->pending, !m->wlr_output->enabled);
|
||||
mango_output_commit(m);
|
||||
m->only_dpms_off = !m->wlr_output->enabled;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ struct Monitor {
|
|||
int32_t isoverview;
|
||||
int32_t is_jump_mode;
|
||||
int32_t is_in_hotarea;
|
||||
int32_t asleep;
|
||||
int32_t only_dpms_off;
|
||||
uint32_t visible_clients;
|
||||
uint32_t visible_tiling_clients;
|
||||
uint32_t visible_scroll_tiling_clients;
|
||||
|
|
@ -5179,7 +5179,7 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int32_t test) {
|
|||
|
||||
/* Ensure displays previously disabled by
|
||||
* wlr-output-power-management-v1 are properly handled*/
|
||||
m->asleep = 0;
|
||||
m->only_dpms_off = 0;
|
||||
|
||||
wlr_output_state_init(&state);
|
||||
wlr_output_state_set_enabled(&state, config_head->state.enabled);
|
||||
|
|
@ -5329,7 +5329,7 @@ void powermgrsetmode(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_state_set_enabled(&m->pending, event->mode);
|
||||
mango_output_commit(m);
|
||||
m->asleep = !event->mode;
|
||||
m->only_dpms_off = !event->mode;
|
||||
updatemons(NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -6987,7 +6987,7 @@ void updatemons(struct wl_listener *listener, void *data) {
|
|||
|
||||
/* First remove from the layout the disabled monitors */
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (m->wlr_output->enabled || m->asleep)
|
||||
if (m->wlr_output->enabled || m->only_dpms_off)
|
||||
continue;
|
||||
config_head = wlr_output_configuration_head_v1_create(output_config,
|
||||
m->wlr_output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue