zoom: Fix config/state changes
This commit is contained in:
parent
d30671c984
commit
b92879e60b
4 changed files with 46 additions and 16 deletions
|
|
@ -11,6 +11,7 @@ use crate::{
|
|||
handlers::xdg_activation::ActivationContext, protocols::workspace::WorkspaceUpdateGuard,
|
||||
},
|
||||
};
|
||||
use calloop::timer::{TimeoutAction, Timer};
|
||||
use cosmic_comp_config::{workspace::WorkspaceLayout, TileBehavior};
|
||||
use cosmic_config::ConfigSet;
|
||||
use cosmic_settings_config::shortcuts;
|
||||
|
|
@ -19,11 +20,11 @@ use smithay::{
|
|||
input::{pointer::MotionEvent, Seat},
|
||||
utils::{Point, Serial},
|
||||
};
|
||||
use tracing::error;
|
||||
#[cfg(not(feature = "debug"))]
|
||||
use tracing::info;
|
||||
use tracing::{error, warn};
|
||||
|
||||
use std::{os::unix::process::CommandExt, thread};
|
||||
use std::{os::unix::process::CommandExt, thread, time::Duration};
|
||||
|
||||
use super::gestures;
|
||||
|
||||
|
|
@ -1045,7 +1046,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
fn spawn_command(&mut self, command: String) {
|
||||
pub fn spawn_command(&mut self, command: String) {
|
||||
let mut shell = self.common.shell.write().unwrap();
|
||||
|
||||
let (token, data) = self.common.xdg_activation_state.create_external_token(None);
|
||||
|
|
@ -1095,7 +1096,7 @@ impl State {
|
|||
.map(|state| (state.current_seat(), state.current_level()))
|
||||
.unwrap_or_else(|| (seat.clone(), 1.0));
|
||||
let change = if current_level == 1.0 && animate {
|
||||
self.common.config.dynamic_conf.zoom_state().last_level
|
||||
self.common.config.dynamic_conf.zoom_state().last_level - 1.0
|
||||
} else {
|
||||
change
|
||||
};
|
||||
|
|
@ -1114,19 +1115,35 @@ impl State {
|
|||
&self.common.event_loop_handle,
|
||||
);
|
||||
|
||||
/* TODO: debounce
|
||||
if new_level > 1.
|
||||
&& self
|
||||
.common
|
||||
if new_level > 1. {
|
||||
// bypass the persistence guard, so that `update_zoom` call pick up the latest value
|
||||
self.common
|
||||
.config
|
||||
.cosmic_conf
|
||||
.dynamic_conf
|
||||
.accessibility_zoom
|
||||
.start_on_login
|
||||
{
|
||||
self.common.config.dynamic_conf.zoom_state_mut().last_level =
|
||||
new_level;
|
||||
.1
|
||||
.last_level = new_level;
|
||||
|
||||
// and then debounce the config write, because of `Super+<Scroll Wheel>`
|
||||
if let Some(token) = self.common.zoom_config_debounce.take() {
|
||||
self.common.event_loop_handle.remove(token);
|
||||
}
|
||||
match self.common.event_loop_handle.insert_source(
|
||||
Timer::from_duration(Duration::from_secs(5)),
|
||||
move |_, _, state| {
|
||||
state.common.config.dynamic_conf.zoom_state_mut().last_level = new_level;
|
||||
let _ = state.common.zoom_config_debounce.take();
|
||||
TimeoutAction::Drop
|
||||
},
|
||||
) {
|
||||
Ok(token) => {
|
||||
self.common.zoom_config_debounce = Some(token);
|
||||
}
|
||||
Err(err) => {
|
||||
warn!("Failed to schedule debounced configuration write: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue