Skip to content

Commit 03a9452

Browse files
committed
fix
Also makes the vertical space under the header use `space_m`, so that it changes its size with density.
1 parent de7eff2 commit 03a9452

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ lto = "thin"
5454
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "bd65e0f2d55429954839c9e6c7bc5b0d198b85f0" }
5555

5656
# For development and testing purposes
57-
[patch.'https://github.com/pop-os/libcosmic']
58-
libcosmic = { git = "https://github.com/git-f0x/libcosmic" }
59-
cosmic-config = { git = "https://github.com/git-f0x/libcosmic" }
57+
# [patch.'https://github.com/pop-os/libcosmic']
6058
# libcosmic = { path = "../libcosmic" }
6159
# cosmic-config = { path = "../libcosmic/cosmic-config" }
6260
# cosmic-theme = { path = "../libcosmic/cosmic-theme" }

cosmic-settings/src/app.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ impl cosmic::Application for SettingsApp {
187187
} else {
188188
icon::from_name("system-search-symbolic")
189189
.apply(button::icon)
190+
.padding(8)
190191
.on_press(Message::SearchActivate)
191192
.into()
192193
});
@@ -833,7 +834,9 @@ impl SettingsApp {
833834

834835
widget::column::with_capacity(3)
835836
.push(self.page_container(header))
836-
.push(widget::vertical_space(24))
837+
.push(widget::vertical_space(Length::Fixed(
838+
cosmic::theme::active().cosmic().space_m().into(),
839+
)))
837840
.push(view)
838841
.height(Length::Fill)
839842
.into()

cosmic-settings/src/pages/desktop/appearance.rs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use std::path::PathBuf;
77
use std::sync::Arc;
88

99
use ashpd::desktop::file_chooser::{FileFilter, SelectedFiles};
10-
use cosmic::config::{CosmicTk, Density};
10+
use cosmic::config::CosmicTk;
1111
use cosmic::cosmic_config::{Config, ConfigSet, CosmicConfigEntry};
1212
use cosmic::cosmic_theme::palette::{FromColor, Hsv, Srgb, Srgba};
1313
use cosmic::cosmic_theme::{
14-
CornerRadii, Spacing, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID,
14+
CornerRadii, Density, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID,
1515
LIGHT_THEME_BUILDER_ID,
1616
};
1717
use cosmic::iced_core::{alignment, Background, Color, Length};
@@ -684,14 +684,29 @@ impl Page {
684684
Message::Density(d) => {
685685
needs_sync = true;
686686
self.density = d;
687+
687688
if let Some(config) = self.tk_config.as_mut() {
688689
let _density = self.tk.set_interface_density(config, d);
689690
let _header = self.tk.set_header_size(config, d);
690691
}
691-
self.theme_builder.spacing = self.density.into();
692-
self.theme_builder_needs_update = true;
693-
Self::update_panel_spacing(d);
694-
Command::none()
692+
693+
let Some(config) = self.theme_builder_config.as_ref() else {
694+
return Command::none();
695+
};
696+
697+
let spacing = self.density.into();
698+
699+
if self
700+
.theme_builder
701+
.set_spacing(config, spacing)
702+
.unwrap_or_default()
703+
{
704+
self.theme_config_write("spacing", spacing);
705+
}
706+
707+
tokio::task::spawn(async move {
708+
Self::update_panel_spacing(d);
709+
});
695710
}
696711

697712
Message::Entered((icon_themes, icon_handles)) => {
@@ -1254,8 +1269,10 @@ impl Page {
12541269

12551270
if let Some(panel_config_helper) = panel_config_helper.as_ref() {
12561271
if let Some(panel_config) = panel_config.as_mut() {
1257-
let density: Spacing = density.into();
1258-
let spacing = density.space_xxxs as u32;
1272+
let spacing = match density {
1273+
Density::Compact => 0,
1274+
_ => 4,
1275+
};
12591276
let update = panel_config.set_spacing(panel_config_helper, spacing);
12601277
if let Err(err) = update {
12611278
tracing::error!(?err, "Error updating panel spacing");
@@ -1265,8 +1282,10 @@ impl Page {
12651282

12661283
if let Some(dock_config_helper) = dock_config_helper.as_ref() {
12671284
if let Some(dock_config) = dock_config.as_mut() {
1268-
let density: Spacing = density.into();
1269-
let spacing = density.space_xxxs as u32;
1285+
let spacing = match density {
1286+
Density::Compact => 0,
1287+
_ => 4,
1288+
};
12701289
let update = dock_config.set_spacing(dock_config_helper, spacing);
12711290
if let Err(err) = update {
12721291
tracing::error!(?err, "Error updating dock spacing");
@@ -1761,7 +1780,8 @@ pub fn interface_density() -> Section<crate::pages::Message> {
17611780
.view::<Page>(move |_binder, page, section| {
17621781
let descriptions = &section.descriptions;
17631782

1764-
settings::view_section(&section.title)
1783+
settings::section()
1784+
.title(&section.title)
17651785
.add(settings::item_row(vec![radio(
17661786
text::body(&descriptions[comfortable]),
17671787
Density::Standard,

0 commit comments

Comments
 (0)