workspace: Add tiling_state
This commit is contained in:
parent
ec822e421f
commit
226bf7f49d
4 changed files with 133 additions and 25 deletions
|
|
@ -8,7 +8,9 @@ use std::{
|
|||
use wayland_backend::server::ClientId;
|
||||
|
||||
use cosmic_comp_config::workspace::{WorkspaceAmount, WorkspaceMode};
|
||||
use cosmic_protocols::workspace::v1::server::zcosmic_workspace_handle_v1::State as WState;
|
||||
use cosmic_protocols::workspace::v1::server::zcosmic_workspace_handle_v1::{
|
||||
State as WState, TilingState,
|
||||
};
|
||||
use keyframe::{ease, functions::EaseInOutCubic};
|
||||
use smithay::{
|
||||
desktop::{
|
||||
|
|
@ -238,7 +240,16 @@ fn create_workspace(
|
|||
tiling: bool,
|
||||
theme: cosmic::Theme,
|
||||
) -> Workspace {
|
||||
let workspace_handle = state.create_workspace(&group_handle).unwrap();
|
||||
let workspace_handle = state
|
||||
.create_workspace(
|
||||
&group_handle,
|
||||
if tiling {
|
||||
TilingState::TilingEnabled
|
||||
} else {
|
||||
TilingState::FloatingOnly
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
if active {
|
||||
state.add_workspace_state(&workspace_handle, WState::Active);
|
||||
}
|
||||
|
|
@ -256,7 +267,16 @@ fn move_workspace_to_group(
|
|||
toplevel_info_state: &mut ToplevelInfoState<State, CosmicSurface>,
|
||||
) {
|
||||
let old_workspace_handle = workspace.handle;
|
||||
workspace.handle = workspace_state.create_workspace(group).unwrap();
|
||||
workspace.handle = workspace_state
|
||||
.create_workspace(
|
||||
group,
|
||||
if workspace.tiling_enabled {
|
||||
TilingState::TilingEnabled
|
||||
} else {
|
||||
TilingState::FloatingOnly
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
workspace_state.set_workspace_capabilities(
|
||||
&workspace.handle,
|
||||
[WorkspaceCapabilities::Activate].into_iter(),
|
||||
|
|
@ -515,15 +535,6 @@ impl WorkspaceSet {
|
|||
workspace_set_idx(state, i as u8 + 1, idx, &workspace.handle);
|
||||
}
|
||||
}
|
||||
|
||||
fn update_tiling_status(&mut self, seat: &Seat<State>, tiling_enabled: bool) {
|
||||
self.tiling_enabled = tiling_enabled;
|
||||
for workspace in &mut self.workspaces {
|
||||
if workspace.tiling_enabled != tiling_enabled {
|
||||
workspace.toggle_tiling(seat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -1001,12 +1012,6 @@ impl Workspaces {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn update_tiling_status(&mut self, seat: &Seat<State>, tiling: bool) {
|
||||
for set in self.sets.values_mut() {
|
||||
set.update_tiling_status(seat, tiling)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_theme(&mut self, theme: cosmic::Theme, xdg_activation_state: &XdgActivationState) {
|
||||
for (_, s) in &mut self.sets {
|
||||
s.theme = theme.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue