@@ -7,11 +7,11 @@ use std::path::PathBuf;
7
7
use std:: sync:: Arc ;
8
8
9
9
use ashpd:: desktop:: file_chooser:: { FileFilter , SelectedFiles } ;
10
- use cosmic:: config:: { CosmicTk , Density } ;
10
+ use cosmic:: config:: CosmicTk ;
11
11
use cosmic:: cosmic_config:: { Config , ConfigSet , CosmicConfigEntry } ;
12
12
use cosmic:: cosmic_theme:: palette:: { FromColor , Hsv , Srgb , Srgba } ;
13
13
use cosmic:: cosmic_theme:: {
14
- CornerRadii , Spacing , Theme , ThemeBuilder , ThemeMode , DARK_THEME_BUILDER_ID ,
14
+ CornerRadii , Density , Theme , ThemeBuilder , ThemeMode , DARK_THEME_BUILDER_ID ,
15
15
LIGHT_THEME_BUILDER_ID ,
16
16
} ;
17
17
use cosmic:: iced_core:: { alignment, Background , Color , Length } ;
@@ -684,14 +684,29 @@ impl Page {
684
684
Message :: Density ( d) => {
685
685
needs_sync = true ;
686
686
self . density = d;
687
+
687
688
if let Some ( config) = self . tk_config . as_mut ( ) {
688
689
let _density = self . tk . set_interface_density ( config, d) ;
689
690
let _header = self . tk . set_header_size ( config, d) ;
690
691
}
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
+ } ) ;
695
710
}
696
711
697
712
Message :: Entered ( ( icon_themes, icon_handles) ) => {
@@ -1254,8 +1269,10 @@ impl Page {
1254
1269
1255
1270
if let Some ( panel_config_helper) = panel_config_helper. as_ref ( ) {
1256
1271
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
+ } ;
1259
1276
let update = panel_config. set_spacing ( panel_config_helper, spacing) ;
1260
1277
if let Err ( err) = update {
1261
1278
tracing:: error!( ?err, "Error updating panel spacing" ) ;
@@ -1265,8 +1282,10 @@ impl Page {
1265
1282
1266
1283
if let Some ( dock_config_helper) = dock_config_helper. as_ref ( ) {
1267
1284
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
+ } ;
1270
1289
let update = dock_config. set_spacing ( dock_config_helper, spacing) ;
1271
1290
if let Err ( err) = update {
1272
1291
tracing:: error!( ?err, "Error updating dock spacing" ) ;
@@ -1761,7 +1780,8 @@ pub fn interface_density() -> Section<crate::pages::Message> {
1761
1780
. view :: < Page > ( move |_binder, page, section| {
1762
1781
let descriptions = & section. descriptions ;
1763
1782
1764
- settings:: view_section ( & section. title )
1783
+ settings:: section ( )
1784
+ . title ( & section. title )
1765
1785
. add ( settings:: item_row ( vec ! [ radio(
1766
1786
text:: body( & descriptions[ comfortable] ) ,
1767
1787
Density :: Standard ,
0 commit comments