diff options
| author | David Donahue <david.donahue2996@gmail.com> | 2024-04-06 11:29:14 -0600 | 
|---|---|---|
| committer | Leonardo Hernández Hernández <leohdz172@proton.me> | 2024-06-20 19:11:53 -0600 | 
| commit | 2902df94d6e3da04b7abc92f846b0da7d40ff4ea (patch) | |
| tree | 10640c3c20b516001a613eb6dcc3082de78436c1 /dwl.c | |
| parent | 9b1f35e42bf435b212dfcdcc510439ef8b4f2e31 (diff) | |
Prevent updatemons() from removing monitors that have been put to sleep from the layout
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 8 | 
1 files changed, 7 insertions, 1 deletions
@@ -207,6 +207,7 @@ struct Monitor {  	int gamma_lut_changed;  	int nmaster;  	char ltsymbol[16]; +	int asleep;  };  typedef struct { @@ -962,6 +963,8 @@ createmon(struct wl_listener *listener, void *data)  	LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);  	LISTEN(&wlr_output->events.request_state, &m->request_state, requestmonstate); +	m->asleep = 0; +  	wlr_output_state_set_enabled(&state, 1);  	wlr_output_commit_state(wlr_output, &state);  	wlr_output_state_finish(&state); @@ -2018,8 +2021,11 @@ void  powermgrsetmodenotify(struct wl_listener *listener, void *data)  {  	struct wlr_output_power_v1_set_mode_event *event = data; +  	wlr_output_enable(event->output, event->mode);  	wlr_output_commit(event->output); + +	((Monitor *)(event->output->data))->asleep = !event->mode;  }  void @@ -2755,7 +2761,7 @@ 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) +		if (m->wlr_output->enabled || m->asleep)  			continue;  		config_head = wlr_output_configuration_head_v1_create(config, m->wlr_output);  		config_head->state.enabled = 0;  | 
