diff --git a/i18n/en/cosmic_ext_tweaks.ftl b/i18n/en/cosmic_ext_tweaks.ftl
index 3eeebcf..5400681 100644
--- a/i18n/en/cosmic_ext_tweaks.ftl
+++ b/i18n/en/cosmic_ext_tweaks.ftl
@@ -57,6 +57,8 @@ size = Size
size-description = The height of the panel and applets
padding = Padding
padding-description = Padding is the space between the contents and the borders of the dock or panel.
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Spacing
spacing-description = Spacing is the space between the icons in the dock or panel.
animation-speed = Animation speed
diff --git a/i18n/es-419/cosmic_ext_tweaks.ftl b/i18n/es-419/cosmic_ext_tweaks.ftl
index 5985701..b689e55 100644
--- a/i18n/es-419/cosmic_ext_tweaks.ftl
+++ b/i18n/es-419/cosmic_ext_tweaks.ftl
@@ -29,7 +29,8 @@ size-description = La altura del panel y los applets
padding = Relleno
padding-description = El relleno es el espacio entre los iconos y el borde del dock o panel.
-
+margin = Margen
+margin-description = Margen es el espacio entre el panel y los bordes de la pantalla.
spacing = Espaciado
spacing-description = El espacio es la distancia entre los iconos en el dock o panel.
diff --git a/i18n/es-MX/cosmic_ext_tweaks.ftl b/i18n/es-MX/cosmic_ext_tweaks.ftl
index 5985701..b689e55 100644
--- a/i18n/es-MX/cosmic_ext_tweaks.ftl
+++ b/i18n/es-MX/cosmic_ext_tweaks.ftl
@@ -29,7 +29,8 @@ size-description = La altura del panel y los applets
padding = Relleno
padding-description = El relleno es el espacio entre los iconos y el borde del dock o panel.
-
+margin = Margen
+margin-description = Margen es el espacio entre el panel y los bordes de la pantalla.
spacing = Espaciado
spacing-description = El espacio es la distancia entre los iconos en el dock o panel.
diff --git a/i18n/es/cosmic_ext_tweaks.ftl b/i18n/es/cosmic_ext_tweaks.ftl
index d592bdf..b7013e8 100644
--- a/i18n/es/cosmic_ext_tweaks.ftl
+++ b/i18n/es/cosmic_ext_tweaks.ftl
@@ -47,7 +47,8 @@ size-description = La altura del panel y los applets
padding = Relleno
padding-description = El relleno es el espacio entre los iconos y el borde del dock o panel.
-
+margin = Margen
+margin-description = Margen es el espacio entre el panel y los bordes de la pantalla.
spacing = Espaciado
spacing-description = El espacio es la distancia entre los iconos en el dock o panel.
diff --git a/i18n/fr/cosmic_ext_tweaks.ftl b/i18n/fr/cosmic_ext_tweaks.ftl
index 81a8779..eb30774 100644
--- a/i18n/fr/cosmic_ext_tweaks.ftl
+++ b/i18n/fr/cosmic_ext_tweaks.ftl
@@ -31,7 +31,8 @@ size-description = La taille du panneau et des applets
padding = Écarts
padding-description = L'écart entre le contenu et les bordures du dock et du panneau.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Espacement
spacing-description = L'espacement est l'espace entre les icônes dans le dock ou le panneau.
diff --git a/i18n/ja/cosmic_ext_tweaks.ftl b/i18n/ja/cosmic_ext_tweaks.ftl
index 9511569..a1468ba 100644
--- a/i18n/ja/cosmic_ext_tweaks.ftl
+++ b/i18n/ja/cosmic_ext_tweaks.ftl
@@ -30,7 +30,8 @@ size-description = The height of the panel and applets
padding = 余白
padding-description = 内容と枠線の間の空間です。
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = 間隔
spacing-description = アイコンの間の空間です。
diff --git a/i18n/nl/cosmic_ext_tweaks.ftl b/i18n/nl/cosmic_ext_tweaks.ftl
index 4b093bd..0867a94 100644
--- a/i18n/nl/cosmic_ext_tweaks.ftl
+++ b/i18n/nl/cosmic_ext_tweaks.ftl
@@ -31,7 +31,8 @@ size-description = The height of the panel and applets
padding = Opvulling
padding-description = De ruimte tussen de inhoud en de randen van de dock of het paneel aanpassen.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Spatiëring
spacing-description = De ruimte tussen de pictogrammen in de dock of het paneel aanpassen.
diff --git a/i18n/pt-BR/cosmic_ext_tweaks.ftl b/i18n/pt-BR/cosmic_ext_tweaks.ftl
index d4ea758..df923f3 100644
--- a/i18n/pt-BR/cosmic_ext_tweaks.ftl
+++ b/i18n/pt-BR/cosmic_ext_tweaks.ftl
@@ -31,7 +31,8 @@ size-description = The height of the panel and applets
padding = Preenchimento
padding-description = O preenchimento é o espaço entre o conteúdo e as bordas da dock ou do painel.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Espaçamento
spacing-description = O espaçamento é o espaço entre os ícones na dock ou no painel.
diff --git a/i18n/ro/cosmic_ext_tweaks.ftl b/i18n/ro/cosmic_ext_tweaks.ftl
index 348471f..94b47be 100644
--- a/i18n/ro/cosmic_ext_tweaks.ftl
+++ b/i18n/ro/cosmic_ext_tweaks.ftl
@@ -31,7 +31,8 @@ size-description = The height of the panel and applets
padding = Margine interioară
padding-description = Marginea interioară este spațiul dintre conținut și marginile dock-ului sau panoului.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Spațiere
spacing-description = Spațierea este distanța dintre pictogramele din dock sau panou.
diff --git a/i18n/sr-Cyrl/cosmic_ext_tweaks.ftl b/i18n/sr-Cyrl/cosmic_ext_tweaks.ftl
index ffac2b0..7c8866e 100644
--- a/i18n/sr-Cyrl/cosmic_ext_tweaks.ftl
+++ b/i18n/sr-Cyrl/cosmic_ext_tweaks.ftl
@@ -33,7 +33,8 @@ size-description = The height of the panel and applets
padding = Пуњење
padding-description = Пуњење је простор између садржаја и ивица дока или панела.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Размак
spacing-description = Размак је простор између иконица на доку или панелу.
diff --git a/i18n/sr-Latn/cosmic_ext_tweaks.ftl b/i18n/sr-Latn/cosmic_ext_tweaks.ftl
index 510ecfe..ef09173 100644
--- a/i18n/sr-Latn/cosmic_ext_tweaks.ftl
+++ b/i18n/sr-Latn/cosmic_ext_tweaks.ftl
@@ -33,7 +33,8 @@ size-description = The height of the panel and applets
padding = Punjenje
padding-description = Punjenje je prostor između sadržaja i ivica doka ili panela.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Razmak
spacing-description = Razmak je prostor između ikonica na doku ili panelu.
diff --git a/i18n/sv/cosmic_ext_tweaks.ftl b/i18n/sv/cosmic_ext_tweaks.ftl
index e04186e..626d2ec 100644
--- a/i18n/sv/cosmic_ext_tweaks.ftl
+++ b/i18n/sv/cosmic_ext_tweaks.ftl
@@ -30,7 +30,8 @@ size-description = The height of the panel and applets
padding = Utfyllnad
padding-description = Utfyllnad är utrymmet mellan innehållet och kanterna på dockan eller panelen.
-
+margin = Margin
+margin-description = Margin is the space between the panel and the edges of the screen.
spacing = Utfyllnad
spacing-description = Avståndet är utrymmet mellan ikonerna i dockan eller panelen.
diff --git a/res/icons/bundled/object-layout-symbolic.svg b/res/icons/bundled/object-layout-symbolic.svg
new file mode 100644
index 0000000..82dd867
--- /dev/null
+++ b/res/icons/bundled/object-layout-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/app.rs b/src/app.rs
index 6462145..9d208da 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -73,7 +73,7 @@ impl Application for App {
Cosmic::init(core, flags)
}
- fn header_start(&self) -> Vec> {
+ fn header_start<'a>(&'a self) -> Vec> {
Cosmic::header_start(self)
}
@@ -85,19 +85,19 @@ impl Application for App {
Cosmic::on_nav_select(self, id)
}
- fn context_drawer(&self) -> Option> {
+ fn context_drawer<'a>(&'a self) -> Option> {
Cosmic::context_drawer(self)
}
- fn dialog(&self) -> Option> {
+ fn dialog<'a>(&'a self) -> Option> {
Cosmic::dialog(self)
}
- fn view(&self) -> Element {
+ fn view<'a>(&'a self) -> Element<'a, Self::Message> {
Cosmic::view(self)
}
- fn footer(&self) -> Option> {
+ fn footer<'a>(&'a self) -> Option> {
Cosmic::footer(self)
}
@@ -118,7 +118,7 @@ impl App {
)])
}
- fn settings(&self) -> Element {
+ fn settings<'a>(&'a self) -> Element<'a, Message> {
let app_theme_selected = match self.config.app_theme {
core::config::AppTheme::Dark => 1,
core::config::AppTheme::Light => 2,
diff --git a/src/app/context_drawer.rs b/src/app/context_drawer.rs
index a8c1993..c142b5c 100644
--- a/src/app/context_drawer.rs
+++ b/src/app/context_drawer.rs
@@ -10,7 +10,7 @@ use crate::app::App;
use super::Cosmic;
impl Cosmic {
- pub fn context_drawer(app: &App) -> Option> {
+ pub fn context_drawer<'a>(app: &'a App) -> Option> {
if !app.core().window.show_context {
return None;
}
diff --git a/src/app/core/icons.rs b/src/app/core/icons.rs
index ff5ee11..a8f38b7 100644
--- a/src/app/core/icons.rs
+++ b/src/app/core/icons.rs
@@ -53,6 +53,7 @@ impl IconCache {
bundle!("dark-mode-symbolic", 18);
bundle!("resize-mode-symbolic", 18);
bundle!("view-coverflow-symbolic", 18);
+ bundle!("object-layout-symbolic", 18);
bundle!("snapshots-symbolic", 18);
bundle!("checkmark-symbolic", 16);
bundle!("recycling-bin-symbolic", 16);
diff --git a/src/app/dialog.rs b/src/app/dialog.rs
index 07ece60..cef3b7e 100644
--- a/src/app/dialog.rs
+++ b/src/app/dialog.rs
@@ -15,7 +15,7 @@ pub enum DialogPage {
}
impl Cosmic {
- pub fn dialog(app: &App) -> Option> {
+ pub fn dialog<'a>(app: &'a App) -> Option> {
let spacing = cosmic::theme::spacing();
let dialog_page = match app.cosmic.dialog_pages.front() {
Some(some) => some,
diff --git a/src/app/footer.rs b/src/app/footer.rs
index eb0e5dc..d6489ae 100644
--- a/src/app/footer.rs
+++ b/src/app/footer.rs
@@ -16,7 +16,7 @@ use crate::app::pages::{
use crate::fl;
impl Cosmic {
- pub fn footer(app: &App) -> Option> {
+ pub fn footer<'a>(app: &'a App) -> Option> {
let spacing = cosmic::theme::spacing();
match app.cosmic.nav_model.active_data::()? {
diff --git a/src/app/header.rs b/src/app/header.rs
index f124285..9262da8 100644
--- a/src/app/header.rs
+++ b/src/app/header.rs
@@ -11,7 +11,7 @@ use crate::app::core::icons;
use crate::fl;
impl Cosmic {
- pub fn header_start(app: &App) -> Vec> {
+ pub fn header_start<'a>(app: &'a App) -> Vec> {
let menu_bar = menu::bar(vec![menu::Tree::with_children(
RcElementWrapper::new(menu::root(fl!("view")).into()),
menu::items(
diff --git a/src/app/pages/dock.rs b/src/app/pages/dock.rs
index 0427e8f..5a559e8 100644
--- a/src/app/pages/dock.rs
+++ b/src/app/pages/dock.rs
@@ -12,6 +12,7 @@ pub struct Dock {
pub dock_helper: Option,
pub dock_config: Option,
pub padding: u32,
+ pub margin: u16,
pub spacing: u32,
autohide: AutoHide,
}
@@ -27,6 +28,7 @@ impl Default for Dock {
.clone()
.map(|config| config.padding)
.unwrap_or(0);
+ let margin = dock_config.clone().map(|config| config.margin).unwrap_or(0);
let spacing = dock_config
.clone()
.map(|config| config.spacing)
@@ -39,6 +41,7 @@ impl Default for Dock {
dock_helper,
dock_config,
padding,
+ margin,
spacing,
autohide,
}
@@ -48,6 +51,7 @@ impl Default for Dock {
#[derive(Debug, Clone)]
pub enum Message {
SetPadding(u32),
+ SetMargin(u16),
SetSpacing(u32),
SetWaitTime(u32),
SetTransitionTime(u32),
@@ -71,6 +75,17 @@ impl Dock {
.spacing(spacing.space_xxs),
),
)
+ .add(
+ widget::settings::item::builder(fl!("margin"))
+ .description(fl!("margin-description"))
+ .icon(icons::get_icon("object-layout-symbolic", 18))
+ .control(
+ widget::row()
+ .push(widget::slider(0..=20, self.margin, Message::SetMargin))
+ .push(widget::text::text(format!("{} px", self.margin)))
+ .spacing(spacing.space_xxs),
+ ),
+ )
.add(
widget::settings::item::builder(fl!("spacing"))
.description(fl!("spacing-description"))
@@ -166,6 +181,13 @@ impl Dock {
log::error!("Error updating dock padding: {}", err);
}
}
+ Message::SetMargin(margin) => {
+ self.margin = margin;
+ let update = dock_config.set_margin(dock_helper, self.margin);
+ if let Err(err) = update {
+ log::error!("Error updating dock margin: {}", err);
+ }
+ }
Message::SetSpacing(spacing) => {
self.spacing = spacing;
let update = dock_config.set_spacing(dock_helper, self.spacing);
diff --git a/src/app/pages/layouts/config.rs b/src/app/pages/layouts/config.rs
index 90cdaa8..2d349e1 100644
--- a/src/app/pages/layouts/config.rs
+++ b/src/app/pages/layouts/config.rs
@@ -26,13 +26,13 @@ impl Layout {
}
}
- pub fn preview(
- &self,
+ pub fn preview<'a>(
+ &'a self,
spacing: &cosmic::cosmic_theme::Spacing,
item_width: usize,
preview_height: u16,
selected_layout: &Option,
- ) -> Element {
+ ) -> Element<'a, Message> {
let mut button = widget::button::custom(self.preview.view(&spacing, preview_height))
.on_press(Message::Select(self.clone()))
.class(cosmic::style::Button::Image)
diff --git a/src/app/pages/layouts/mod.rs b/src/app/pages/layouts/mod.rs
index fc69214..e2cdcee 100644
--- a/src/app/pages/layouts/mod.rs
+++ b/src/app/pages/layouts/mod.rs
@@ -82,7 +82,7 @@ impl Layouts {
Ok(())
}
- pub fn view(&self) -> Element {
+ pub fn view<'a>(&'a self) -> Element<'a, Message> {
let spacing = cosmic::theme::spacing();
let grid = widget::responsive(move |size| {
let GridMetrics {
diff --git a/src/app/pages/panel/mod.rs b/src/app/pages/panel/mod.rs
index 6ebb7d2..ceae5fa 100644
--- a/src/app/pages/panel/mod.rs
+++ b/src/app/pages/panel/mod.rs
@@ -18,6 +18,7 @@ pub struct Panel {
pub panel_helper: Option,
pub panel_config: Option,
pub padding: u32,
+ pub margin: u16,
pub spacing: u32,
pub show_panel: bool,
pub cosmic_panel_config: CosmicPanel,
@@ -96,6 +97,10 @@ impl Default for Panel {
.clone()
.map(|config| config.padding)
.unwrap_or(0);
+ let margin = panel_config
+ .clone()
+ .map(|config| config.margin)
+ .unwrap_or(0);
let spacing = panel_config
.clone()
.map(|config| config.spacing)
@@ -124,6 +129,7 @@ impl Default for Panel {
panel_helper,
panel_config,
padding,
+ margin,
spacing,
show_panel,
cosmic_panel_config,
@@ -140,6 +146,7 @@ impl Default for Panel {
#[derive(Debug, Clone)]
pub enum Message {
SetPadding(u32),
+ SetMargin(u16),
SetSpacing(u32),
ShowPanel(bool),
ForceIcons(bool),
@@ -196,6 +203,17 @@ impl Panel {
.spacing(spacing.space_xxs),
),
)
+ .add(
+ widget::settings::item::builder(fl!("margin"))
+ .description(fl!("margin-description"))
+ .icon(icons::get_icon("object-layout-symbolic", 18))
+ .control(
+ widget::row()
+ .push(widget::slider(0..=20, self.margin, Message::SetMargin))
+ .push(widget::text::text(format!("{} px", self.margin)))
+ .spacing(spacing.space_xxs),
+ ),
+ )
.add(
widget::settings::item::builder(fl!("spacing"))
.description(fl!("spacing-description"))
@@ -291,6 +309,13 @@ impl Panel {
log::error!("Error updating panel padding: {}", err);
}
}
+ Message::SetMargin(margin) => {
+ self.margin = margin;
+ let update = panel_config.set_margin(panel_helper, self.margin);
+ if let Err(err) = update {
+ log::error!("Error updating panel margin: {}", err);
+ }
+ }
Message::SetSpacing(spacing) => {
self.spacing = spacing;
let update = panel_config.set_spacing(panel_helper, self.spacing);
diff --git a/src/app/pages/snapshots/mod.rs b/src/app/pages/snapshots/mod.rs
index cc4c008..e613136 100644
--- a/src/app/pages/snapshots/mod.rs
+++ b/src/app/pages/snapshots/mod.rs
@@ -39,7 +39,7 @@ pub enum Message {
}
impl Snapshots {
- pub fn view(&self) -> Element {
+ pub fn view<'a>(&'a self) -> Element<'a, Message> {
let spacing = cosmic::theme::spacing();
let snapshots = self
.snapshots
diff --git a/src/app/view.rs b/src/app/view.rs
index b7622c9..67ea738 100644
--- a/src/app/view.rs
+++ b/src/app/view.rs
@@ -8,7 +8,7 @@ use crate::app::{message::Message, page::Page, App};
use super::Cosmic;
impl Cosmic {
- pub fn view(app: &App) -> Element {
+ pub fn view<'a>(app: &'a App) -> Element<'a, Message> {
let spacing = cosmic::theme::spacing();
let entity = app.cosmic.nav_model.active();
let nav_page = app