diff --git a/src/api.rs b/src/api.rs index 9035769..2b2e710 100644 --- a/src/api.rs +++ b/src/api.rs @@ -774,25 +774,15 @@ impl tag_service_server::TagService for TagService { .map(|id| id.0) .collect::>(); - if let Some(saved_state) = state.config.connector_saved_states.get_mut(&output_name) { - let mut tags = saved_state.tags.clone(); - tags.extend(new_tags.clone()); - saved_state.tags = tags; - } else { - state.config.connector_saved_states.insert( - output_name.clone(), - crate::config::ConnectorSavedState { - tags: new_tags.clone(), - ..Default::default() - }, - ); - } + state + .config + .connector_saved_states + .entry(output_name.clone()) + .or_default() + .tags + .extend(new_tags.clone()); - if let Some(output) = state - .space - .outputs() - .find(|output| output.name() == output_name.0) - { + if let Some(output) = output_name.output(state) { output.with_state_mut(|state| { state.tags.extend(new_tags.clone()); debug!("tags added, are now {:?}", state.tags); diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 2ff0e2c..a5b8df3 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -998,9 +998,9 @@ impl State { .connector_saved_states .get(&OutputName(output.name())) { - let ConnectorSavedState { loc, tags } = saved_state; + let ConnectorSavedState { loc, tags, scale } = saved_state; - output.change_current_state(None, None, None, Some(*loc)); + output.change_current_state(None, None, *scale, Some(*loc)); self.space.map_output(&output, *loc); output.with_state_mut(|state| state.tags = tags.clone()); @@ -1050,6 +1050,7 @@ impl State { ConnectorSavedState { loc: output.current_location(), tags: output.with_state(|state| state.tags.clone()), + scale: Some(output.current_scale()), }, ); self.space.unmap_output(&output); diff --git a/src/config.rs b/src/config.rs index 890ddff..c92b355 100644 --- a/src/config.rs +++ b/src/config.rs @@ -214,6 +214,8 @@ pub struct ConnectorSavedState { pub loc: Point, /// The output's previous tags pub tags: Vec, + /// The output's previous scale + pub scale: Option, } /// Parse a metaconfig file in `config_dir`, if any.