config: Add and propagate appearance_config

This commit is contained in:
Victoria Brekenfeld 2025-12-08 18:21:58 +01:00 committed by Victoria Brekenfeld
parent 94d49210e6
commit 2adebb5fe1
10 changed files with 213 additions and 40 deletions

View file

@ -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 {