feat: config changes
This commit is contained in:
parent
e24ef3fbbd
commit
e87d101217
12 changed files with 129 additions and 159 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::fl;
|
||||
use cascade::cascade;
|
||||
use cosmic_panel_config::CosmicPanelConfig;
|
||||
use cosmic_panel_config::{CosmicPanelConfig, PanelSize};
|
||||
use gtk4::{
|
||||
gio::{self, DesktopAppInfo, Icon},
|
||||
glib::{self, Object},
|
||||
|
|
@ -41,7 +41,14 @@ impl CosmicPanelAppButtonWindow {
|
|||
Button::new();
|
||||
..add_css_class("apps");
|
||||
};
|
||||
let config = CosmicPanelConfig::load_from_env().unwrap_or_default();
|
||||
let pixels = std::env::var("COSMIC_PANEL_SIZE").ok().and_then(|size| match size.parse::<PanelSize>() {
|
||||
Ok(PanelSize::XL) => Some(64),
|
||||
Ok(PanelSize::L) => Some(48),
|
||||
Ok(PanelSize::M) => Some(36),
|
||||
Ok(PanelSize::S) => Some(24),
|
||||
Ok(PanelSize::XS) => Some(18),
|
||||
Err(_) => Some(36),
|
||||
}).unwrap_or(36);
|
||||
let icon = apps_desktop_info.icon().unwrap_or_else(|| {
|
||||
Icon::for_string("image-missing").expect("Failed to set default icon")
|
||||
});
|
||||
|
|
@ -50,7 +57,7 @@ impl CosmicPanelAppButtonWindow {
|
|||
gtk4::Image::from_gicon(&icon);
|
||||
..set_hexpand(true);
|
||||
..set_halign(Align::Center);
|
||||
..set_pixel_size(config.get_applet_icon_size().try_into().unwrap());
|
||||
..set_pixel_size(pixels);
|
||||
..set_tooltip_text(Some(&apps_desktop_info.name()));
|
||||
};
|
||||
container.append(&image);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue