refactor(tiling): remove tile windows on workspaces
This commit is contained in:
parent
f789038c3f
commit
91a865846a
1 changed files with 5 additions and 41 deletions
|
|
@ -34,7 +34,6 @@ pub struct Window {
|
||||||
config_helper: Config,
|
config_helper: Config,
|
||||||
autotile_behavior_model: segmented_button::SingleSelectModel,
|
autotile_behavior_model: segmented_button::SingleSelectModel,
|
||||||
new_workspace_behavior_model: segmented_button::SingleSelectModel,
|
new_workspace_behavior_model: segmented_button::SingleSelectModel,
|
||||||
autotile_global_entity: Entity,
|
|
||||||
new_workspace_entity: Entity,
|
new_workspace_entity: Entity,
|
||||||
/// may not match the config value if behavior is per-workspace
|
/// may not match the config value if behavior is per-workspace
|
||||||
autotiled: bool,
|
autotiled: bool,
|
||||||
|
|
@ -51,7 +50,6 @@ pub enum Message {
|
||||||
ToggleTileWindows(chain::Toggler, bool),
|
ToggleTileWindows(chain::Toggler, bool),
|
||||||
ToggleActiveHint(chain::Toggler, bool),
|
ToggleActiveHint(chain::Toggler, bool),
|
||||||
MyConfigUpdate(Box<CosmicCompConfig>),
|
MyConfigUpdate(Box<CosmicCompConfig>),
|
||||||
TileMode(Entity),
|
|
||||||
WorkspaceUpdate(WorkspacesUpdate),
|
WorkspaceUpdate(WorkspacesUpdate),
|
||||||
NewWorkspace(Entity),
|
NewWorkspace(Entity),
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +122,6 @@ impl cosmic::Application for Window {
|
||||||
config_helper,
|
config_helper,
|
||||||
autotile_behavior_model,
|
autotile_behavior_model,
|
||||||
new_workspace_behavior_model,
|
new_workspace_behavior_model,
|
||||||
autotile_global_entity,
|
|
||||||
new_workspace_entity,
|
new_workspace_entity,
|
||||||
workspace_tx: None,
|
workspace_tx: None,
|
||||||
tile_windows: id::Toggler::unique(),
|
tile_windows: id::Toggler::unique(),
|
||||||
|
|
@ -277,27 +274,6 @@ impl cosmic::Application for Window {
|
||||||
|
|
||||||
self.config = *c;
|
self.config = *c;
|
||||||
}
|
}
|
||||||
Message::TileMode(e) => {
|
|
||||||
let behavior = if e == self.autotile_global_entity {
|
|
||||||
TileBehavior::Global
|
|
||||||
} else {
|
|
||||||
TileBehavior::PerWorkspace
|
|
||||||
};
|
|
||||||
|
|
||||||
self.config.autotile_behavior = behavior;
|
|
||||||
self.autotile_behavior_model.activate(e);
|
|
||||||
let helper = self.config_helper.clone();
|
|
||||||
let need_to_reset_autotile = self.autotiled != self.config.autotile
|
|
||||||
&& matches!(behavior, TileBehavior::Global);
|
|
||||||
if need_to_reset_autotile {
|
|
||||||
self.autotiled = self.config.autotile;
|
|
||||||
}
|
|
||||||
thread::spawn(move || {
|
|
||||||
if let Err(err) = helper.set("autotile_behavior", behavior) {
|
|
||||||
error!(?err, "Failed to set autotile_behavior {behavior:?}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Message::NewWorkspace(e) => {
|
Message::NewWorkspace(e) => {
|
||||||
let autotile_new = self.new_workspace_entity == e;
|
let autotile_new = self.new_workspace_entity == e;
|
||||||
self.config.autotile = autotile_new;
|
self.config.autotile = autotile_new;
|
||||||
|
|
@ -323,7 +299,6 @@ impl cosmic::Application for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_window(&self, _id: Id) -> Element<Self::Message> {
|
fn view_window(&self, _id: Id) -> Element<Self::Message> {
|
||||||
let space_xxs = self.core.system_theme().cosmic().space_xxs();
|
|
||||||
let mut new_workspace_behavior_button =
|
let mut new_workspace_behavior_button =
|
||||||
segmented_control::horizontal(&self.new_workspace_behavior_model);
|
segmented_control::horizontal(&self.new_workspace_behavior_model);
|
||||||
if matches!(self.config.autotile_behavior, TileBehavior::PerWorkspace) {
|
if matches!(self.config.autotile_behavior, TileBehavior::PerWorkspace) {
|
||||||
|
|
@ -347,22 +322,11 @@ impl cosmic::Application for Window {
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
))
|
))
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
padded_control(
|
padded_control(divider::horizontal::default(),),
|
||||||
column![
|
padded_control(column![
|
||||||
divider::horizontal::default(),
|
text(fl!("new-workspace")).size(14),
|
||||||
column![
|
new_workspace_behavior_button,
|
||||||
text(fl!("autotile-behavior")).size(14),
|
]),
|
||||||
segmented_control::horizontal(&self.autotile_behavior_model)
|
|
||||||
.on_activate(Message::TileMode)
|
|
||||||
],
|
|
||||||
divider::horizontal::default(),
|
|
||||||
column![
|
|
||||||
text(fl!("new-workspace")).size(14),
|
|
||||||
new_workspace_behavior_button,
|
|
||||||
]
|
|
||||||
]
|
|
||||||
.spacing(space_xxs)
|
|
||||||
),
|
|
||||||
padded_control(divider::horizontal::default()),
|
padded_control(divider::horizontal::default()),
|
||||||
padded_control(row!(
|
padded_control(row!(
|
||||||
text(fl!("navigate-windows")).size(14).width(Length::Fill),
|
text(fl!("navigate-windows")).size(14).width(Length::Fill),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue