config: Add and propagate appearance_config
This commit is contained in:
parent
94d49210e6
commit
2adebb5fe1
10 changed files with 213 additions and 40 deletions
|
|
@ -49,6 +49,13 @@ pub enum NumlockState {
|
|||
LastBoot,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
pub struct AppearanceConfig {
|
||||
pub clip_floating_windows: bool,
|
||||
pub clip_tiled_windows: bool,
|
||||
pub shadow_tiled_windows: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, CosmicConfigEntry)]
|
||||
#[version = 1]
|
||||
pub struct CosmicCompConfig {
|
||||
|
|
@ -81,6 +88,7 @@ pub struct CosmicCompConfig {
|
|||
/// The threshold before windows snap themselves to output edges
|
||||
pub edge_snap_threshold: u32,
|
||||
pub accessibility_zoom: ZoomConfig,
|
||||
pub appearance_settings: AppearanceConfig,
|
||||
}
|
||||
|
||||
impl Default for CosmicCompConfig {
|
||||
|
|
@ -116,6 +124,7 @@ impl Default for CosmicCompConfig {
|
|||
xwayland_eavesdropping: XwaylandEavesdropping::default(),
|
||||
edge_snap_threshold: 0,
|
||||
accessibility_zoom: ZoomConfig::default(),
|
||||
appearance_settings: AppearanceConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ mod types;
|
|||
use cosmic::config::CosmicTk;
|
||||
pub use cosmic_comp_config::EdidProduct;
|
||||
use cosmic_comp_config::{
|
||||
CosmicCompConfig, KeyboardConfig, TileBehavior, XkbConfig, XwaylandDescaling,
|
||||
AppearanceConfig, CosmicCompConfig, KeyboardConfig, TileBehavior, XkbConfig, XwaylandDescaling,
|
||||
XwaylandEavesdropping, ZoomConfig,
|
||||
input::{DeviceState as InputDeviceState, InputConfig, TouchpadOverride},
|
||||
output::comp::{
|
||||
|
|
@ -942,6 +942,16 @@ fn config_changed(config: cosmic_config::Config, keys: Vec<String>, state: &mut
|
|||
state.common.update_config();
|
||||
}
|
||||
}
|
||||
"appearance_settings" => {
|
||||
let new = get_config::<AppearanceConfig>(&config, "appearance_settings");
|
||||
if new != state.common.config.cosmic_conf.appearance_settings {
|
||||
state.common.config.cosmic_conf.appearance_settings = new;
|
||||
state.common.update_config();
|
||||
for output in state.common.shell.read().outputs() {
|
||||
state.backend.schedule_render(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use crate::{
|
|||
utils::{iced::IcedElementInternal, prelude::*},
|
||||
};
|
||||
use calloop::LoopHandle;
|
||||
use cosmic_comp_config::AppearanceConfig;
|
||||
use id_tree::NodeId;
|
||||
use smithay::{
|
||||
backend::{
|
||||
|
|
@ -500,13 +501,14 @@ impl CosmicMapped {
|
|||
&mut self,
|
||||
(output, overlap): (&Output, Rectangle<i32, Logical>),
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) {
|
||||
if let CosmicMappedInternal::Window(window) = &self.element {
|
||||
let surface = window.surface();
|
||||
let activated = surface.is_activated(true);
|
||||
let handle = window.loop_handle();
|
||||
|
||||
let stack = CosmicStack::new(std::iter::once(surface), handle, theme);
|
||||
let stack = CosmicStack::new(std::iter::once(surface), handle, theme, appearance);
|
||||
if let Some(geo) = *self.last_geometry.lock().unwrap() {
|
||||
stack.set_geometry(geo.to_global(output));
|
||||
}
|
||||
|
|
@ -524,11 +526,12 @@ impl CosmicMapped {
|
|||
surface: CosmicSurface,
|
||||
(output, overlap): (&Output, Rectangle<i32, Logical>),
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) {
|
||||
let handle = self.loop_handle();
|
||||
surface.try_force_undecorated(false);
|
||||
surface.set_tiled(false);
|
||||
let window = CosmicWindow::new(surface, handle, theme);
|
||||
let window = CosmicWindow::new(surface, handle, theme, appearance);
|
||||
|
||||
if let Some(geo) = *self.last_geometry.lock().unwrap() {
|
||||
window.set_geometry(geo.to_global(output));
|
||||
|
|
@ -810,6 +813,14 @@ impl CosmicMapped {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn update_appearance_conf(&self, appearance: &AppearanceConfig) {
|
||||
match &self.element {
|
||||
CosmicMappedInternal::Window(w) => w.update_appearance_conf(appearance),
|
||||
CosmicMappedInternal::Stack(s) => s.update_appearance_conf(appearance),
|
||||
CosmicMappedInternal::_GenericCatcher(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn force_redraw(&self) {
|
||||
match &self.element {
|
||||
CosmicMappedInternal::Window(w) => w.force_redraw(),
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use cosmic::{
|
|||
iced_widget::scrollable::AbsoluteOffset,
|
||||
theme, widget as cosmic_widget,
|
||||
};
|
||||
use cosmic_comp_config::AppearanceConfig;
|
||||
use cosmic_settings_config::shortcuts;
|
||||
use shortcuts::action::{Direction, FocusDirection};
|
||||
use smithay::{
|
||||
|
|
@ -106,6 +107,7 @@ pub struct CosmicStackInternal {
|
|||
override_alive: AtomicBool,
|
||||
geometry: Mutex<Option<Rectangle<i32, Global>>>,
|
||||
mask: Mutex<Option<tiny_skia::Mask>>,
|
||||
appearance_conf: Mutex<AppearanceConfig>,
|
||||
}
|
||||
|
||||
impl CosmicStackInternal {
|
||||
|
|
@ -133,6 +135,7 @@ impl CosmicStack {
|
|||
windows: impl Iterator<Item = I>,
|
||||
handle: LoopHandle<'static, crate::state::State>,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> CosmicStack {
|
||||
let windows = windows.map(Into::into).collect::<Vec<_>>();
|
||||
assert!(!windows.is_empty());
|
||||
|
|
@ -159,6 +162,7 @@ impl CosmicStack {
|
|||
override_alive: AtomicBool::new(true),
|
||||
geometry: Mutex::new(None),
|
||||
mask: Mutex::new(None),
|
||||
appearance_conf: Mutex::new(appearance),
|
||||
},
|
||||
(width, TAB_HEIGHT),
|
||||
handle,
|
||||
|
|
@ -681,6 +685,21 @@ impl CosmicStack {
|
|||
self.0.set_theme(theme);
|
||||
}
|
||||
|
||||
pub fn update_appearance_conf(&self, appearance: &AppearanceConfig) {
|
||||
if self.0.with_program(|p| {
|
||||
let mut conf = p.appearance_conf.lock().unwrap();
|
||||
if &*conf != appearance {
|
||||
*conf = *appearance;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}) {
|
||||
self.0.force_redraw();
|
||||
self.0.force_update();
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn force_redraw(&self) {
|
||||
self.0.force_redraw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use crate::{
|
|||
};
|
||||
use calloop::LoopHandle;
|
||||
use cosmic::iced::{Color, Task};
|
||||
use cosmic_comp_config::AppearanceConfig;
|
||||
use smithay::{
|
||||
backend::{
|
||||
input::KeyState,
|
||||
|
|
@ -72,23 +73,14 @@ impl fmt::Debug for CosmicWindow {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CosmicWindowInternal {
|
||||
pub(super) window: CosmicSurface,
|
||||
activated: AtomicBool,
|
||||
/// TODO: This needs to be per seat
|
||||
pointer_entered: AtomicU8,
|
||||
last_title: Mutex<String>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for CosmicWindowInternal {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("CosmicWindowInternal")
|
||||
.field("window", &self.window)
|
||||
.field("activated", &self.activated.load(Ordering::SeqCst))
|
||||
.field("pointer_entered", &self.pointer_entered)
|
||||
// skip seat to avoid loop
|
||||
.finish()
|
||||
}
|
||||
appearance_conf: Mutex<AppearanceConfig>,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
|
|
@ -184,6 +176,7 @@ impl CosmicWindow {
|
|||
window: impl Into<CosmicSurface>,
|
||||
handle: LoopHandle<'static, crate::state::State>,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> CosmicWindow {
|
||||
let window = window.into();
|
||||
let width = window.geometry().size.w;
|
||||
|
|
@ -194,6 +187,7 @@ impl CosmicWindow {
|
|||
activated: AtomicBool::new(false),
|
||||
pointer_entered: AtomicU8::new(0),
|
||||
last_title: Mutex::new(last_title),
|
||||
appearance_conf: Mutex::new(appearance),
|
||||
},
|
||||
(width, SSD_HEIGHT),
|
||||
handle,
|
||||
|
|
@ -387,6 +381,22 @@ impl CosmicWindow {
|
|||
self.0.set_theme(theme);
|
||||
}
|
||||
|
||||
pub fn update_appearance_conf(&self, appearance: &AppearanceConfig) {
|
||||
self.0.with_program(|p| {
|
||||
let mut conf = p.appearance_conf.lock().unwrap();
|
||||
if &*conf != appearance {
|
||||
*conf = *appearance;
|
||||
if appearance.clip_floating_windows {
|
||||
p.window.set_tiled(true);
|
||||
} else {
|
||||
if !p.tiled.load(Ordering::Acquire) {
|
||||
p.window.set_tiled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn force_redraw(&self) {
|
||||
self.0.force_redraw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ pub fn tab_items(
|
|||
surface,
|
||||
state.common.event_loop_handle.clone(),
|
||||
state.common.theme.clone(),
|
||||
state.common.config.cosmic_conf.appearance_settings,
|
||||
)
|
||||
.into();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use std::{
|
|||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use cosmic_comp_config::AppearanceConfig;
|
||||
use cosmic_settings_config::shortcuts::action::ResizeDirection;
|
||||
use keyframe::{ease, functions::EaseInOutCubic};
|
||||
use smithay::{
|
||||
|
|
@ -59,6 +60,7 @@ pub struct FloatingLayout {
|
|||
hovered_stack: Option<(CosmicMapped, Rectangle<i32, Local>)>,
|
||||
dirty: AtomicBool,
|
||||
pub theme: cosmic::Theme,
|
||||
pub appearance: AppearanceConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -263,10 +265,15 @@ impl TiledCorners {
|
|||
}
|
||||
|
||||
impl FloatingLayout {
|
||||
pub fn new(theme: cosmic::Theme, output: &Output) -> FloatingLayout {
|
||||
pub fn new(
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
output: &Output,
|
||||
) -> FloatingLayout {
|
||||
let mut layout = Self {
|
||||
theme,
|
||||
last_output_size: output.geometry().size.as_local(),
|
||||
appearance,
|
||||
..Default::default()
|
||||
};
|
||||
layout.space.map_output(output, (0, 0));
|
||||
|
|
@ -1014,7 +1021,11 @@ impl FloatingLayout {
|
|||
if mapped.is_window() {
|
||||
// if it is just a window
|
||||
self.space.unmap_elem(&mapped);
|
||||
mapped.convert_to_stack((&output, mapped.bbox()), self.theme.clone());
|
||||
mapped.convert_to_stack(
|
||||
(&output, mapped.bbox()),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
self.map_internal(
|
||||
mapped.clone(),
|
||||
Some(location.as_local()),
|
||||
|
|
@ -1031,7 +1042,12 @@ impl FloatingLayout {
|
|||
|
||||
self.space.unmap_elem(&mapped);
|
||||
let handle = mapped.loop_handle();
|
||||
mapped.convert_to_surface(first, (&output, mapped.bbox()), self.theme.clone());
|
||||
mapped.convert_to_surface(
|
||||
first,
|
||||
(&output, mapped.bbox()),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
let mut new_elements = vec![mapped.clone()];
|
||||
|
||||
// map the rest
|
||||
|
|
@ -1043,6 +1059,7 @@ impl FloatingLayout {
|
|||
other,
|
||||
handle.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
));
|
||||
window.output_enter(&output, window.bbox());
|
||||
|
||||
|
|
@ -1094,7 +1111,7 @@ impl FloatingLayout {
|
|||
StackMoveResult::Handled => MoveResult::Done,
|
||||
StackMoveResult::MoveOut(surface, loop_handle) => {
|
||||
let mapped: CosmicMapped =
|
||||
CosmicWindow::new(surface, loop_handle, theme.clone()).into();
|
||||
CosmicWindow::new(surface, loop_handle, theme.clone(), self.appearance).into();
|
||||
let output = seat.active_output();
|
||||
let pos = self.space.element_geometry(element).unwrap().loc
|
||||
+ match direction {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
use cosmic_comp_config::AppearanceConfig;
|
||||
use cosmic_settings_config::shortcuts::action::{FocusDirection, ResizeDirection};
|
||||
use id_tree::{InsertBehavior, MoveBehavior, Node, NodeId, NodeIdError, RemoveBehavior, Tree};
|
||||
use keyframe::{
|
||||
|
|
@ -134,6 +135,7 @@ pub struct TilingLayout {
|
|||
swapping_stack_surface_id: Id,
|
||||
last_overview_hover: Option<(Option<Instant>, TargetZone)>,
|
||||
pub theme: cosmic::Theme,
|
||||
pub appearance: AppearanceConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
@ -345,7 +347,11 @@ pub struct RestoreTilingState {
|
|||
}
|
||||
|
||||
impl TilingLayout {
|
||||
pub fn new(theme: cosmic::Theme, output: &Output) -> TilingLayout {
|
||||
pub fn new(
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
output: &Output,
|
||||
) -> TilingLayout {
|
||||
TilingLayout {
|
||||
queue: TreeQueue {
|
||||
trees: {
|
||||
|
|
@ -360,6 +366,7 @@ impl TilingLayout {
|
|||
swapping_stack_surface_id: Id::new(),
|
||||
last_overview_hover: None,
|
||||
theme,
|
||||
appearance,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -664,9 +671,13 @@ impl TilingLayout {
|
|||
let _ = this.unmap(this_mapped, None);
|
||||
}
|
||||
|
||||
let mapped: CosmicMapped =
|
||||
CosmicWindow::new(stack_surface, this_stack.loop_handle(), this.theme.clone())
|
||||
.into();
|
||||
let mapped: CosmicMapped = CosmicWindow::new(
|
||||
stack_surface,
|
||||
this_stack.loop_handle(),
|
||||
this.theme.clone(),
|
||||
this.appearance,
|
||||
)
|
||||
.into();
|
||||
if this.output != other.output {
|
||||
mapped.output_leave(&this.output);
|
||||
mapped.output_enter(&other.output, mapped.bbox());
|
||||
|
|
@ -1071,6 +1082,7 @@ impl TilingLayout {
|
|||
this_surface.clone(),
|
||||
this_stack.loop_handle(),
|
||||
this.theme.clone(),
|
||||
this.appearance,
|
||||
)
|
||||
.into();
|
||||
mapped.set_tiled(true);
|
||||
|
|
@ -1156,6 +1168,7 @@ impl TilingLayout {
|
|||
other_surface.clone(),
|
||||
other_stack.loop_handle(),
|
||||
this.theme.clone(),
|
||||
this.appearance,
|
||||
)
|
||||
.into();
|
||||
mapped.set_tiled(true);
|
||||
|
|
@ -1504,8 +1517,13 @@ impl TilingLayout {
|
|||
match window.handle_move(direction) {
|
||||
StackMoveResult::Handled => return MoveResult::Done,
|
||||
StackMoveResult::MoveOut(surface, loop_handle) => {
|
||||
let mapped: CosmicMapped =
|
||||
CosmicWindow::new(surface, loop_handle, self.theme.clone()).into();
|
||||
let mapped: CosmicMapped = CosmicWindow::new(
|
||||
surface,
|
||||
loop_handle,
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
)
|
||||
.into();
|
||||
mapped.output_enter(&self.output, mapped.bbox());
|
||||
let orientation = match direction {
|
||||
Direction::Left | Direction::Right => Orientation::Vertical,
|
||||
|
|
@ -2126,7 +2144,11 @@ impl TilingLayout {
|
|||
// if it is just a window
|
||||
match tree.get_mut(&node_id).unwrap().data_mut() {
|
||||
Data::Mapped { mapped, .. } => {
|
||||
mapped.convert_to_stack((&self.output, mapped.bbox()), self.theme.clone());
|
||||
mapped.convert_to_stack(
|
||||
(&self.output, mapped.bbox()),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
focus_stack.append(mapped.clone());
|
||||
KeyboardFocusTarget::Element(mapped.clone())
|
||||
}
|
||||
|
|
@ -2147,6 +2169,7 @@ impl TilingLayout {
|
|||
first,
|
||||
(&self.output, mapped.bbox()),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
new_elements.push(mapped.clone());
|
||||
handle
|
||||
|
|
@ -2164,6 +2187,7 @@ impl TilingLayout {
|
|||
other,
|
||||
handle.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
));
|
||||
window.output_enter(&self.output, window.bbox());
|
||||
|
||||
|
|
@ -2261,7 +2285,12 @@ impl TilingLayout {
|
|||
return None;
|
||||
}
|
||||
let handle = handle.unwrap();
|
||||
let stack = CosmicStack::new(surfaces.into_iter(), handle, self.theme.clone());
|
||||
let stack = CosmicStack::new(
|
||||
surfaces.into_iter(),
|
||||
handle,
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
|
||||
for child in tree
|
||||
.children_ids(&last_active)
|
||||
|
|
@ -2732,7 +2761,11 @@ impl TilingLayout {
|
|||
Some(TargetZone::WindowStack(window_id, _)) if tree.get(window_id).is_ok() => {
|
||||
match tree.get_mut(window_id).unwrap().data_mut() {
|
||||
Data::Mapped { mapped, .. } => {
|
||||
mapped.convert_to_stack((&self.output, mapped.bbox()), self.theme.clone());
|
||||
mapped.convert_to_stack(
|
||||
(&self.output, mapped.bbox()),
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
let Some(stack) = mapped.stack_ref() else {
|
||||
unreachable!()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
use cosmic_comp_config::{
|
||||
TileBehavior, ZoomConfig, ZoomMovement,
|
||||
AppearanceConfig, TileBehavior, ZoomConfig, ZoomMovement,
|
||||
workspace::{PinnedWorkspace, WorkspaceLayout, WorkspaceMode},
|
||||
};
|
||||
use cosmic_config::ConfigSet;
|
||||
|
|
@ -286,6 +286,7 @@ pub struct Shell {
|
|||
)>,
|
||||
resize_indicator: Option<ResizeIndicator>,
|
||||
zoom_state: Option<ZoomState>,
|
||||
appearance_conf: AppearanceConfig,
|
||||
tiling_exceptions: TilingExceptions,
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
|
|
@ -356,6 +357,7 @@ pub struct WorkspaceSet {
|
|||
tiling_enabled: bool,
|
||||
output: Output,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
pub sticky_layer: FloatingLayout,
|
||||
pub minimized_windows: Vec<MinimizedWindow>,
|
||||
pub workspaces: Vec<Workspace>,
|
||||
|
|
@ -368,6 +370,7 @@ fn create_workspace(
|
|||
active: bool,
|
||||
tiling: bool,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> Workspace {
|
||||
let workspace_handle = state
|
||||
.create_workspace(
|
||||
|
|
@ -391,7 +394,13 @@ fn create_workspace(
|
|||
| WorkspaceCapabilities::Pin
|
||||
| WorkspaceCapabilities::Move,
|
||||
);
|
||||
Workspace::new(workspace_handle, output.clone(), tiling, theme.clone())
|
||||
Workspace::new(
|
||||
workspace_handle,
|
||||
output.clone(),
|
||||
tiling,
|
||||
theme.clone(),
|
||||
appearance,
|
||||
)
|
||||
}
|
||||
|
||||
fn create_workspace_from_pinned(
|
||||
|
|
@ -401,6 +410,7 @@ fn create_workspace_from_pinned(
|
|||
group_handle: &WorkspaceGroupHandle,
|
||||
active: bool,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> Workspace {
|
||||
let workspace_handle = state
|
||||
.create_workspace(
|
||||
|
|
@ -424,7 +434,13 @@ fn create_workspace_from_pinned(
|
|||
| WorkspaceCapabilities::Pin
|
||||
| WorkspaceCapabilities::Move,
|
||||
);
|
||||
Workspace::from_pinned(pinned, workspace_handle, output.clone(), theme.clone())
|
||||
Workspace::from_pinned(
|
||||
pinned,
|
||||
workspace_handle,
|
||||
output.clone(),
|
||||
theme.clone(),
|
||||
appearance,
|
||||
)
|
||||
}
|
||||
|
||||
/* We will probably need this again at some point
|
||||
|
|
@ -458,21 +474,23 @@ impl WorkspaceSet {
|
|||
state: &mut WorkspaceUpdateGuard<'_, State>,
|
||||
output: &Output,
|
||||
tiling_enabled: bool,
|
||||
theme: cosmic::Theme,
|
||||
theme: &cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> WorkspaceSet {
|
||||
let group_handle = state.create_workspace_group();
|
||||
let sticky_layer = FloatingLayout::new(theme.clone(), output);
|
||||
let sticky_layer = FloatingLayout::new(theme.clone(), appearance.clone(), output);
|
||||
|
||||
WorkspaceSet {
|
||||
previously_active: None,
|
||||
active: 0,
|
||||
group: group_handle,
|
||||
tiling_enabled,
|
||||
theme,
|
||||
theme: theme.clone(),
|
||||
sticky_layer,
|
||||
minimized_windows: Vec::new(),
|
||||
workspaces: Vec::new(),
|
||||
output: output.clone(),
|
||||
appearance,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -590,6 +608,7 @@ impl WorkspaceSet {
|
|||
false,
|
||||
self.tiling_enabled,
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
workspace_set_idx(
|
||||
state,
|
||||
|
|
@ -718,6 +737,7 @@ pub struct Workspaces {
|
|||
autotile: bool,
|
||||
autotile_behavior: TileBehavior,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
// Persisted workspace to add on first `output_add`
|
||||
persisted_workspaces: Vec<PinnedWorkspace>,
|
||||
}
|
||||
|
|
@ -732,6 +752,7 @@ impl Workspaces {
|
|||
autotile: config.cosmic_conf.autotile,
|
||||
autotile_behavior: config.cosmic_conf.autotile_behavior,
|
||||
theme,
|
||||
appearance: config.cosmic_conf.appearance_settings.clone(),
|
||||
persisted_workspaces: config.cosmic_conf.pinned_workspaces.clone(),
|
||||
}
|
||||
}
|
||||
|
|
@ -753,7 +774,13 @@ impl Workspaces {
|
|||
set
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
WorkspaceSet::new(workspace_state, output, self.autotile, self.theme.clone())
|
||||
WorkspaceSet::new(
|
||||
workspace_state,
|
||||
output,
|
||||
self.autotile,
|
||||
&self.theme,
|
||||
self.appearance,
|
||||
)
|
||||
});
|
||||
workspace_state.add_group_output(&set.group, output);
|
||||
|
||||
|
|
@ -766,6 +793,7 @@ impl Workspaces {
|
|||
&set.group,
|
||||
false,
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
);
|
||||
set.workspaces.push(workspace);
|
||||
}
|
||||
|
|
@ -1043,6 +1071,16 @@ impl Workspaces {
|
|||
let old_mode = self.mode;
|
||||
self.mode = config.cosmic_conf.workspaces.workspace_mode;
|
||||
self.layout = config.cosmic_conf.workspaces.workspace_layout;
|
||||
self.appearance = config.cosmic_conf.appearance_settings;
|
||||
|
||||
for set in self.sets.values_mut() {
|
||||
set.appearance = self.appearance;
|
||||
set.sticky_layer.appearance = self.appearance;
|
||||
for workspace in set.workspaces.iter_mut() {
|
||||
workspace.floating_layer.appearance = self.appearance;
|
||||
workspace.tiling_layer.appearance = self.appearance;
|
||||
}
|
||||
}
|
||||
|
||||
if self.sets.len() <= 1 {
|
||||
return;
|
||||
|
|
@ -1089,6 +1127,7 @@ impl Workspaces {
|
|||
false,
|
||||
config.cosmic_conf.autotile,
|
||||
self.theme.clone(),
|
||||
self.appearance,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -1422,6 +1461,7 @@ impl Common {
|
|||
let mut shell = self.shell.write();
|
||||
let shell_ref = &mut *shell;
|
||||
shell_ref.active_hint = self.config.cosmic_conf.active_hint;
|
||||
shell_ref.appearance_conf = self.config.cosmic_conf.appearance_settings.clone();
|
||||
if let Some(zoom_state) = shell_ref.zoom_state.as_mut() {
|
||||
zoom_state.increment = self.config.cosmic_conf.accessibility_zoom.increment;
|
||||
zoom_state.movement = self.config.cosmic_conf.accessibility_zoom.view_moves;
|
||||
|
|
@ -1441,6 +1481,10 @@ impl Common {
|
|||
&mut workspace_state,
|
||||
&self.xdg_activation_state,
|
||||
);
|
||||
|
||||
for mapped in shell_ref.mapped() {
|
||||
mapped.update_appearance_conf(&self.config.cosmic_conf.appearance_settings);
|
||||
}
|
||||
}
|
||||
|
||||
#[profiling::function]
|
||||
|
|
@ -1550,6 +1594,7 @@ impl Shell {
|
|||
resize_mode: ResizeMode::None,
|
||||
resize_state: None,
|
||||
resize_indicator: None,
|
||||
appearance_conf: config.cosmic_conf.appearance_settings.clone(),
|
||||
zoom_state: None,
|
||||
tiling_exceptions,
|
||||
|
||||
|
|
@ -2252,6 +2297,10 @@ impl Shell {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn appearance_config(&self) -> AppearanceConfig {
|
||||
self.appearance_conf.clone()
|
||||
}
|
||||
|
||||
pub fn trigger_zoom(
|
||||
&mut self,
|
||||
seat: &Seat<State>,
|
||||
|
|
@ -2454,6 +2503,7 @@ impl Shell {
|
|||
surface,
|
||||
loop_handle.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
));
|
||||
|
||||
if let Some(FullscreenRestoreState::Sticky { output, state, .. }) = &state {
|
||||
|
|
@ -2730,6 +2780,7 @@ impl Shell {
|
|||
window.clone(),
|
||||
loop_handle.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
));
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
|
|
@ -3117,6 +3168,7 @@ impl Shell {
|
|||
window.clone(),
|
||||
evlh.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
));
|
||||
window.set_minimized(true);
|
||||
MinimizedWindow::Floating { window, previous }
|
||||
|
|
@ -3126,6 +3178,7 @@ impl Shell {
|
|||
window.clone(),
|
||||
evlh.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
));
|
||||
window.set_minimized(true);
|
||||
MinimizedWindow::Tiling { window, previous }
|
||||
|
|
@ -3184,6 +3237,7 @@ impl Shell {
|
|||
window.clone(),
|
||||
evlh.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
));
|
||||
let position = match window_state {
|
||||
WorkspaceRestoreData::Floating(Some(data)) => Some(
|
||||
|
|
@ -3200,6 +3254,7 @@ impl Shell {
|
|||
window.clone(),
|
||||
evlh.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
));
|
||||
for mapped in to_workspace
|
||||
.mapped()
|
||||
|
|
@ -3537,8 +3592,13 @@ impl Shell {
|
|||
.unwrap();
|
||||
|
||||
let mapped = if move_out_of_stack {
|
||||
let new_mapped: CosmicMapped =
|
||||
CosmicWindow::new(window.clone(), evlh.clone(), self.theme.clone()).into();
|
||||
let new_mapped: CosmicMapped = CosmicWindow::new(
|
||||
window.clone(),
|
||||
evlh.clone(),
|
||||
self.theme.clone(),
|
||||
self.appearance_conf,
|
||||
)
|
||||
.into();
|
||||
if old_mapped.is_maximized(false) {
|
||||
new_mapped.set_maximized(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use crate::{
|
|||
},
|
||||
},
|
||||
};
|
||||
use cosmic_comp_config::AppearanceConfig;
|
||||
use cosmic_comp_config::workspace::{OutputMatch, PinnedWorkspace};
|
||||
|
||||
use cosmic::theme::CosmicTheme;
|
||||
|
|
@ -359,9 +360,10 @@ impl Workspace {
|
|||
output: Output,
|
||||
tiling_enabled: bool,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> Workspace {
|
||||
let tiling_layer = TilingLayout::new(theme.clone(), &output);
|
||||
let floating_layer = FloatingLayout::new(theme, &output);
|
||||
let tiling_layer = TilingLayout::new(theme.clone(), appearance, &output);
|
||||
let floating_layer = FloatingLayout::new(theme, appearance, &output);
|
||||
let output_match = output_match_for_output(&output);
|
||||
|
||||
Workspace {
|
||||
|
|
@ -391,9 +393,10 @@ impl Workspace {
|
|||
handle: WorkspaceHandle,
|
||||
output: Output,
|
||||
theme: cosmic::Theme,
|
||||
appearance: AppearanceConfig,
|
||||
) -> Self {
|
||||
let tiling_layer = TilingLayout::new(theme.clone(), &output);
|
||||
let floating_layer = FloatingLayout::new(theme, &output);
|
||||
let tiling_layer = TilingLayout::new(theme.clone(), appearance, &output);
|
||||
let floating_layer = FloatingLayout::new(theme, appearance, &output);
|
||||
let output_match = output_match_for_output(&output);
|
||||
|
||||
Workspace {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue