fix: padding, spacing, context menu style, and settings buttons

This commit is contained in:
Vukašin Vojinović 2024-09-24 15:52:17 +02:00 committed by GitHub
parent 0a32d27c70
commit 941cbf546b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 694 additions and 538 deletions

889
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -41,7 +41,7 @@ use cosmic::{
accept_mime_type, finish_dnd, request_dnd_data, set_actions, start_drag, accept_mime_type, finish_dnd, request_dnd_data, set_actions, start_drag,
}, },
iced_style::{application, svg}, iced_style::{application, svg},
theme::{Button, Container}, theme::{self, Button, Container},
widget::{ widget::{
button, divider, horizontal_space, icon, button, divider, horizontal_space, icon,
icon::from_name, icon::from_name,
@ -62,7 +62,7 @@ use futures::future::pending;
use iced::{widget::container, Alignment, Background, Length}; use iced::{widget::container, Alignment, Background, Length};
use itertools::Itertools; use itertools::Itertools;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use std::{collections::HashMap, fs, path::PathBuf, rc::Rc, str::FromStr, time::Duration}; use std::{collections::HashMap, path::PathBuf, rc::Rc, str::FromStr, time::Duration};
use switcheroo_control::Gpu; use switcheroo_control::Gpu;
use tokio::time::sleep; use tokio::time::sleep;
use url::Url; use url::Url;
@ -262,7 +262,7 @@ impl DockItem {
.into(), .into(),
}; };
let icon_button = cosmic::widget::button(icon_wrapper) let icon_button = button::custom(icon_wrapper)
.padding(app_icon.padding) .padding(app_icon.padding)
.selected(is_focused) .selected(is_focused)
.style(app_list_icon_style(is_focused)); .style(app_list_icon_style(is_focused));
@ -456,7 +456,7 @@ where
Msg: 'static + Clone, Msg: 'static + Clone,
{ {
let border = 1.0; let border = 1.0;
cosmic::widget::button( button::custom(
container( container(
column![ column![
container(if let Some(img) = img { container(if let Some(img) = img {
@ -1715,14 +1715,14 @@ impl cosmic::Application for CosmicAppList {
fn menu_button<'a, Message>( fn menu_button<'a, Message>(
content: impl Into<Element<'a, Message>>, content: impl Into<Element<'a, Message>>,
) -> cosmic::widget::Button<'a, Message> { ) -> cosmic::widget::Button<'a, Message> {
cosmic::widget::button(content) button::custom(content)
.height(36) .height(20 + 2 * theme::active().cosmic().space_xxs())
.style(Button::AppletMenu) .style(Button::MenuItem)
.padding(menu_control_padding()) .padding(menu_control_padding())
.width(Length::Fill) .width(Length::Fill)
} }
let mut content = column![].padding([8, 0]).align_items(Alignment::Center); let mut content = column![].align_items(Alignment::Center);
if let Some(exec) = desktop_info.exec() { if let Some(exec) = desktop_info.exec() {
if !toplevels.is_empty() { if !toplevels.is_empty() {
@ -1774,7 +1774,7 @@ impl cosmic::Application for CosmicAppList {
.on_press(Message::Exec(exec.into(), None)), .on_press(Message::Exec(exec.into(), None)),
); );
} }
content = content.push(divider::horizontal::default()); content = content.push(divider::horizontal::light());
} }
if !toplevels.is_empty() { if !toplevels.is_empty() {
@ -1791,7 +1791,7 @@ impl cosmic::Application for CosmicAppList {
); );
} }
content = content.push(list_col); content = content.push(list_col);
content = content.push(divider::horizontal::default()); content = content.push(divider::horizontal::light());
} }
let svg_accent = Rc::new(|theme: &cosmic::Theme| { let svg_accent = Rc::new(|theme: &cosmic::Theme| {
@ -1820,7 +1820,7 @@ impl cosmic::Application for CosmicAppList {
); );
if toplevels.len() > 0 { if toplevels.len() > 0 {
content = content.push(divider::horizontal::default()); content = content.push(divider::horizontal::light());
content = match toplevels.len() { content = match toplevels.len() {
1 => content.push( 1 => content.push(
menu_button(text::body(fl!("quit"))) menu_button(text::body(fl!("quit")))
@ -1832,7 +1832,26 @@ impl cosmic::Application for CosmicAppList {
), ),
}; };
} }
self.core.applet.popup_container(content).into() container(content)
.padding(1)
//TODO: move style to libcosmic
.style(theme::Container::custom(|theme| {
let cosmic = theme.cosmic();
let component = &cosmic.background.component;
container::Appearance {
icon_color: Some(component.on.into()),
text_color: Some(component.on.into()),
background: Some(Background::Color(component.base.into())),
border: Border {
radius: 8.0.into(),
width: 1.0,
color: component.divider.into(),
},
..Default::default()
}
}))
.width(Length::Fill)
.into()
} }
PopupType::TopLevelList => match self.core.applet.anchor { PopupType::TopLevelList => match self.core.applet.anchor {
PanelAnchor::Left | PanelAnchor::Right => { PanelAnchor::Left | PanelAnchor::Right => {

View file

@ -1,6 +1,6 @@
output = Output output = Output
input = Input input = Input
show-media-controls = Show Media Controls on Top Panel show-media-controls = Show media controls on panel
sound-settings = Sound Settings... sound-settings = Sound Settings...
disconnected = PulseAudio Disconnected disconnected = PulseAudio Disconnected
no-device = No device selected no-device = No device selected

View file

@ -15,15 +15,17 @@ use cosmic::{
menu_button, menu_control_padding, padded_control, menu_button, menu_control_padding, padded_control,
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate}, token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
}, },
cctk::sctk::reexports::{calloop, protocols::xdg::shell::client::xdg_positioner::Anchor}, cctk::sctk::reexports::calloop,
cosmic_config::CosmicConfigEntry, cosmic_config::CosmicConfigEntry,
cosmic_theme::Spacing,
iced::{ iced::{
self, self,
widget::{self, column, row, slider}, widget::{self, column, row, slider},
window, Alignment, Length, Limits, Rectangle, Subscription, window, Alignment, Length, Limits, Subscription,
}, },
iced_runtime::core::alignment::Horizontal, iced_runtime::core::alignment::Horizontal,
iced_style::application, iced_style::application,
theme,
widget::{button, divider, horizontal_space, icon, text, Column, Row}, widget::{button, divider, horizontal_space, icon, text, Column, Row},
Element, Renderer, Theme, Element, Renderer, Theme,
}; };
@ -665,6 +667,9 @@ impl cosmic::Application for Audio {
input.mute = value; input.mute = value;
} }
} }
sub_pulse::Event::DefaultSink(_) => {}
sub_pulse::Event::DefaultSource(_) => {}
sub_pulse::Event::CardInfo(_) => {}
}, },
}; };
@ -735,16 +740,19 @@ impl cosmic::Application for Audio {
} }
fn view_window(&self, _id: window::Id) -> Element<Message> { fn view_window(&self, _id: window::Id) -> Element<Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let audio_disabled = matches!(self.pulse_state, PulseState::Disconnected(_)); let audio_disabled = matches!(self.pulse_state, PulseState::Disconnected(_));
let out_mute = self.current_output_mute(); let out_mute = self.current_output_mute();
let in_mute = self.current_input_mute(); let in_mute = self.current_input_mute();
let mut audio_content = if audio_disabled { let mut audio_content = if audio_disabled {
column![padded_control( column![padded_control(
text(fl!("disconnected")) text::title3(fl!("disconnected"))
.width(Length::Fill) .width(Length::Fill)
.horizontal_alignment(Horizontal::Center) .horizontal_alignment(Horizontal::Center)
.size(24)
)] )]
} else { } else {
column![ column![
@ -790,7 +798,7 @@ impl cosmic::Application for Audio {
.spacing(12) .spacing(12)
.align_items(Alignment::Center) .align_items(Alignment::Center)
), ),
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
revealer( revealer(
self.is_open == IsOpen::Output, self.is_open == IsOpen::Output,
fl!("output"), fl!("output"),
@ -906,7 +914,8 @@ impl cosmic::Application for Audio {
.into(), .into(),
); );
audio_content = audio_content.push(padded_control(divider::horizontal::default())); audio_content = audio_content
.push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]));
audio_content = audio_content.push( audio_content = audio_content.push(
Row::with_children(elements) Row::with_children(elements)
.align_items(Alignment::Center) .align_items(Alignment::Center)
@ -916,7 +925,7 @@ impl cosmic::Application for Audio {
} }
let content = column![ let content = column![
audio_content, audio_content,
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control( padded_control(
anim!( anim!(
// toggler // toggler
@ -928,9 +937,8 @@ impl cosmic::Application for Audio {
) )
.text_size(14) .text_size(14)
.width(Length::Fill) .width(Length::Fill)
) ),
.padding([8, 24]), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control(divider::horizontal::default()),
menu_button(text::body(fl!("sound-settings"))).on_press(Message::OpenSettings) menu_button(text::body(fl!("sound-settings"))).on_press(Message::OpenSettings)
] ]
.align_items(Alignment::Start) .align_items(Alignment::Start)

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Taste
battery = Akku battery = Akku
battery-desc = Reduzierter Stromverbrauch und Leistung. battery-desc = Reduzierter Stromverbrauch und Leistung.
balanced = Ausgeglichen balanced = Ausgeglichen
@ -12,4 +11,4 @@ hours = h
until-empty = bis leer until-empty = bis leer
power-settings = Energie- und Akkueinstellungen... power-settings = Energie- und Akkueinstellungen...
dgpu-running = Dedizierte GPU ist aktiv und kann die Akkulaufzeit reduzieren dgpu-running = Dedizierte GPU ist aktiv und kann die Akkulaufzeit reduzieren
dgpu-applications = Anwendungen, die die dedizierte GPU {$gpu_name} nutzen dgpu-applications = Anwendungen, die die dedizierte GPU {$gpu_name} nutzen

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Button
battery = Battery battery = Battery
battery-desc = Reduced power usage and performance. battery-desc = Reduced power usage and performance.
balanced = Balanced balanced = Balanced
@ -10,6 +9,6 @@ seconds = s
minutes = m minutes = m
hours = h hours = h
until-empty = until empty until-empty = until empty
power-settings = Power and Battery Settings... power-settings = Power & Battery settings...
dgpu-running = Discrete GPU is active and can reduce battery life dgpu-running = Discrete GPU is active and can reduce battery life
dgpu-applications = Applications using {$gpu_name} discrete GPU dgpu-applications = Applications using {$gpu_name} discrete GPU

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Botón de Cosmic
battery = Ahorro de energía battery = Ahorro de energía
battery-desc = Rendimiento y uso de energía reducido. battery-desc = Rendimiento y uso de energía reducido.
balanced = Balanceado balanced = Balanceado

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Botón Cosmic
battery = Batería battery = Batería
battery-desc = Rendimiento y consumo de alimentación reducidos. battery-desc = Rendimiento y consumo de alimentación reducidos.
balanced = Balanceado balanced = Balanceado

View file

@ -1,4 +1,3 @@
cosmic-applet-button = دکمه Cosmic
battery = باتری battery = باتری
battery-desc = کاهش مصرف برق و عملکرد. battery-desc = کاهش مصرف برق و عملکرد.
balanced = متعادل balanced = متعادل

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Painike
battery = Akku battery = Akku
battery-desc = Vähentynyt virrankulutus ja suorituskyky. battery-desc = Vähentynyt virrankulutus ja suorituskyky.
balanced = Tasapainoitettu balanced = Tasapainoitettu

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Bouton Cosmic
battery = Batterie battery = Batterie
battery-desc = Performance et consommation réduites. battery-desc = Performance et consommation réduites.
balanced = Équilibré balanced = Équilibré
@ -12,4 +11,4 @@ hours = h
until-empty = avant la décharge totale until-empty = avant la décharge totale
power-settings = Paramètres d'alimentation... power-settings = Paramètres d'alimentation...
dgpu-running = Le GPU dédié est actif et peu réduire l'autonomie de la batterie dgpu-running = Le GPU dédié est actif et peu réduire l'autonomie de la batterie
dgpu-applications = Applications utilisant le GPU dédié {$gpu_name} dgpu-applications = Applications utilisant le GPU dédié {$gpu_name}

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Gomb
battery = Akkumulátor battery = Akkumulátor
battery-desc = Csökkentett energiafogyasztás és teljesítmény. battery-desc = Csökkentett energiafogyasztás és teljesítmény.
balanced = Kiegyensúlyozott balanced = Kiegyensúlyozott
@ -12,4 +11,4 @@ hours = h
until-empty = lemerülésig until-empty = lemerülésig
power-settings = Tápellátás és akkumulátor beállítások... power-settings = Tápellátás és akkumulátor beállítások...
dgpu-running = A dedikált GPU aktív, és csökkentheti az akkumulátor élettartamát dgpu-running = A dedikált GPU aktív, és csökkentheti az akkumulátor élettartamát
dgpu-applications = A {$gpu_name} dedikált GPU-t használó alkalmazások dgpu-applications = A {$gpu_name} dedikált GPU-t használó alkalmazások

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Tombol Cosmic
battery = Baterai battery = Baterai
battery-desc = Penggunaan daya dan kinerja yang dikurangi. battery-desc = Penggunaan daya dan kinerja yang dikurangi.
balanced = Seimbang balanced = Seimbang
@ -7,9 +6,9 @@ performance = Kinerja Tinggi
performance-desc = Kinerja dan penggunaan daya yang tinggi. performance-desc = Kinerja dan penggunaan daya yang tinggi.
max-charge = Tingkatkan masa pakai baterai Anda dengan mengatur nilai pengisian maksimum 80% max-charge = Tingkatkan masa pakai baterai Anda dengan mengatur nilai pengisian maksimum 80%
seconds = d seconds = d
minutes = m minutes = m
hours = j hours = j
until-empty = hingga kosong until-empty = hingga kosong
power-settings = Pengaturan Daya dan Baterai... power-settings = Pengaturan Daya dan Baterai...
dgpu-running = GPU Diskrit aktif dan dapat mengurangi masa pakai baterai dgpu-running = GPU Diskrit aktif dan dapat mengurangi masa pakai baterai
dgpu-applications = Aplikasi yang menggunakan {$gpu_name} GPU Diskrit dgpu-applications = Aplikasi yang menggunakan {$gpu_name} GPU Diskrit

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Pulsante Cosmic
battery = Batteria battery = Batteria
battery-desc = Consumi e performance ridotte. battery-desc = Consumi e performance ridotte.
balanced = Bilanciato balanced = Bilanciato
@ -12,4 +11,4 @@ hours = h
until-empty = fino alla scarica until-empty = fino alla scarica
power-settings = Impostazioni energetiche power-settings = Impostazioni energetiche
dgpu-running = La GPU discreta è attiva e può ridurre la durata della batteria. dgpu-running = La GPU discreta è attiva e può ridurre la durata della batteria.
dgpu-applications = Applicazioni che stanno usando la GPU discreta {$gpu_name} dgpu-applications = Applicazioni che stanno usando la GPU discreta {$gpu_name}

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmicボタン
battery = バッテリー battery = バッテリー
battery-desc = 性能と消費は低くなります。 battery-desc = 性能と消費は低くなります。
balanced = バランス balanced = バランス

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Knop
battery = Batterij battery = Batterij
battery-desc = Verminderd stroom verbruik en prestatie. battery-desc = Verminderd stroom verbruik en prestatie.
balanced = Gebalanceerd balanced = Gebalanceerd

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Przycisk Cosmic
battery = Na Baterii battery = Na Baterii
battery-desc = Zmniejszone zużycie energii i zmniejszona wydajność. battery-desc = Zmniejszone zużycie energii i zmniejszona wydajność.
balanced = Zbalansowany balanced = Zbalansowany

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Botão Cosmic
battery = Bateria battery = Bateria
battery-desc = Uso reduzido de energia e desempenho. battery-desc = Uso reduzido de energia e desempenho.
balanced = Equilibrado balanced = Equilibrado

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Botão Cosmic
battery = Bateria battery = Bateria
battery-desc = Uso reduzido de energia e desempenho. battery-desc = Uso reduzido de energia e desempenho.
balanced = Equilibrado balanced = Equilibrado

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Кнопка Cosmic
battery = Аккумулятор battery = Аккумулятор
battery-desc = Пониженные энергопотребление и производительность. battery-desc = Пониженные энергопотребление и производительность.
balanced = Сбалансированный balanced = Сбалансированный
@ -12,4 +11,4 @@ hours = ч.
until-empty = до полного разряда until-empty = до полного разряда
power-settings = Параметры питания и аккумулятора... power-settings = Параметры питания и аккумулятора...
dgpu-running = Дискретная видеокарта активна и может сократить время автономной работы dgpu-running = Дискретная видеокарта активна и может сократить время автономной работы
dgpu-applications = Приложения, использующие видеокарту {$gpu_name} dgpu-applications = Приложения, использующие видеокарту {$gpu_name}

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Button
battery = Batéria battery = Batéria
battery-desc = Obmedzená spotreba energie a výkonu. battery-desc = Obmedzená spotreba energie a výkonu.
balanced = Vyvážený balanced = Vyvážený
@ -12,4 +11,4 @@ hours = h
until-empty = pokiaľ prázdne until-empty = pokiaľ prázdne
power-settings = Nastavenia napájania a batérie... power-settings = Nastavenia napájania a batérie...
dgpu-running = Diskrétne GPU sa práve používa. To môže ovplyvniť životnosť batérie. dgpu-running = Diskrétne GPU sa práve používa. To môže ovplyvniť životnosť batérie.
dgpu-applications = Aplikácie, ktoré používajú {$gpu_name} diskrétne GPU dgpu-applications = Aplikácie, ktoré používajú {$gpu_name} diskrétne GPU

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic дугме
battery = Батерија battery = Батерија
battery-desc = Смањене перформансе и потрошња батерије. battery-desc = Смањене перформансе и потрошња батерије.
balanced = Балансирано balanced = Балансирано

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic dugme
battery = Baterija battery = Baterija
battery-desc = Smanjene performanse i potrošnja baterije. battery-desc = Smanjene performanse i potrošnja baterije.
balanced = Balansirano balanced = Balansirano

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic Düğmesi
battery = Pil battery = Pil
battery-desc = Daha az güç tüketimi ve başarım. battery-desc = Daha az güç tüketimi ve başarım.
balanced = Dengeli balanced = Dengeli

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Кнопка Cosmic
battery = Акумулятор battery = Акумулятор
battery-desc = Зменшення споживання енергії та продуктивності. battery-desc = Зменшення споживання енергії та продуктивності.
balanced = Збалансовано balanced = Збалансовано

View file

@ -1,4 +1,3 @@
cosmic-applet-button = Cosmic 按钮
battery = 省电 battery = 省电
battery-desc = 降低功耗和性能 battery-desc = 降低功耗和性能
balanced = 平衡 balanced = 平衡

View file

@ -17,6 +17,7 @@ use cosmic::{
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate}, token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
}, },
cctk::sctk::reexports::calloop, cctk::sctk::reexports::calloop,
cosmic_theme::Spacing,
iced::{ iced::{
alignment::Horizontal, alignment::Horizontal,
wayland::popup::{destroy_popup, get_popup}, wayland::popup::{destroy_popup, get_popup},
@ -27,6 +28,7 @@ use cosmic::{
iced_runtime::core::layout::Limits, iced_runtime::core::layout::Limits,
iced_style::application, iced_style::application,
iced_widget::{Column, Row}, iced_widget::{Column, Row},
theme,
widget::{divider, horizontal_space, icon, scrollable, text, vertical_space}, widget::{divider, horizontal_space, icon, scrollable, text, vertical_space},
Command, Element, Theme, Command, Element, Theme,
}; };
@ -446,6 +448,10 @@ impl cosmic::Application for CosmicBatteryApplet {
} }
fn view_window(&self, _id: window::Id) -> Element<Message> { fn view_window(&self, _id: window::Id) -> Element<Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let name = text::body(fl!("battery")); let name = text::body(fl!("battery"));
let description = text::caption(if !self.on_battery { let description = text::caption(if !self.on_battery {
format!("{:.0}%", self.battery_percent) format!("{:.0}%", self.battery_percent)
@ -468,7 +474,9 @@ impl cosmic::Application for CosmicBatteryApplet {
.align_items(Alignment::Center), .align_items(Alignment::Center),
) )
.into(), .into(),
padded_control(divider::horizontal::default()).into(), padded_control(divider::horizontal::default())
.padding([space_xxs, space_s])
.into(),
menu_button( menu_button(
row![ row![
column![ column![
@ -532,7 +540,9 @@ impl cosmic::Application for CosmicBatteryApplet {
) )
.on_press(Message::SelectProfile(Power::Performance)) .on_press(Message::SelectProfile(Power::Performance))
.into(), .into(),
padded_control(divider::horizontal::default()).into(), padded_control(divider::horizontal::default())
.padding([space_xxs, space_s])
.into(),
padded_control( padded_control(
anim!( anim!(
//toggler //toggler
@ -546,7 +556,9 @@ impl cosmic::Application for CosmicBatteryApplet {
.width(Length::Fill), .width(Length::Fill),
) )
.into(), .into(),
padded_control(divider::horizontal::default()).into(), padded_control(divider::horizontal::default())
.padding([space_xxs, space_s])
.into(),
]; ];
if let Some(max_screen_brightness) = self.max_screen_brightness { if let Some(max_screen_brightness) = self.max_screen_brightness {
@ -605,7 +617,11 @@ impl cosmic::Application for CosmicBatteryApplet {
} }
} }
content.push(padded_control(divider::horizontal::default()).into()); content.push(
padded_control(divider::horizontal::default())
.padding([space_xxs, space_s])
.into(),
);
if !self.gpus.is_empty() { if !self.gpus.is_empty() {
content.push( content.push(
@ -637,7 +653,11 @@ impl cosmic::Application for CosmicBatteryApplet {
) )
.into(), .into(),
); );
content.push(padded_control(divider::horizontal::default()).into()); content.push(
padded_control(divider::horizontal::default())
.padding([space_xxs, space_s])
.into(),
);
} }
for (key, gpu) in &self.gpus { for (key, gpu) in &self.gpus {
@ -706,7 +726,11 @@ impl cosmic::Application for CosmicBatteryApplet {
.into(), .into(),
); );
} }
content.push(padded_control(divider::horizontal::default()).into()); content.push(
padded_control(divider::horizontal::default())
.padding([space_xxs, space_s])
.into(),
);
} }
content.push( content.push(

View file

@ -1,6 +1,6 @@
bluetooth = Bluetooth bluetooth = Bluetooth
other-devices = Other Bluetooth Devices other-devices = Other Bluetooth devices
settings = Bluetooth Settings... settings = Bluetooth settings...
connected = Connected connected = Connected
confirm-pin = Please confirm that the following PIN matches the one displayed on {$deviceName} confirm-pin = Please confirm that the following PIN matches the one displayed on {$deviceName}
confirm = Confirm confirm = Confirm
@ -9,4 +9,4 @@ unsuccessful = Pairing Unsuccessful
check-device = Make sure {$deviceName} is turned on, in range, and is ready to pair. check-device = Make sure {$deviceName} is turned on, in range, and is ready to pair.
try-again = Try Again try-again = Try Again
discoverable = Discoverable discoverable = Discoverable
pairable = Pairable pairable = Pairable

View file

@ -9,6 +9,7 @@ use cosmic::{
use cosmic::{ use cosmic::{
applet::{menu_button, padded_control}, applet::{menu_button, padded_control},
cosmic_theme::Spacing,
iced::{ iced::{
self, self,
wayland::popup::{destroy_popup, get_popup}, wayland::popup::{destroy_popup, get_popup},
@ -21,6 +22,7 @@ use cosmic::{
window, window,
}, },
iced_style::application, iced_style::application,
theme,
widget::{button, divider, icon, text}, widget::{button, divider, icon, text},
Command, Element, Theme, Command, Element, Theme,
}; };
@ -349,6 +351,10 @@ impl cosmic::Application for CosmicBluetoothApplet {
} }
fn view_window(&self, _id: window::Id) -> Element<Message> { fn view_window(&self, _id: window::Id) -> Element<Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let mut known_bluetooth = vec![]; let mut known_bluetooth = vec![];
for dev in self.bluer_state.devices.iter().filter(|d| { for dev in self.bluer_state.devices.iter().filter(|d| {
!self !self
@ -447,20 +453,21 @@ impl cosmic::Application for CosmicBluetoothApplet {
.align_items(Alignment::Center) .align_items(Alignment::Center)
.padding([8, 0]); .padding([8, 0]);
if !known_bluetooth.is_empty() { if !known_bluetooth.is_empty() {
content = content.push(padded_control(divider::horizontal::default())); content = content
.push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]));
content = content.push(Column::with_children(known_bluetooth)); content = content.push(Column::with_children(known_bluetooth));
} }
let dropdown_icon = if self.show_visible_devices { let dropdown_icon = if self.show_visible_devices {
"go-down-symbolic" "go-up-symbolic"
} else { } else {
"go-next-symbolic" "go-down-symbolic"
}; };
let available_connections_btn = menu_button(row![ let available_connections_btn = menu_button(row![
text::body(fl!("other-devices")) text::body(fl!("other-devices"))
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fixed(24.0)) .height(Length::Fixed(24.0))
.vertical_alignment(Vertical::Center), .vertical_alignment(Vertical::Center),
container(icon::from_name(dropdown_icon).size(14).symbolic(true)) container(icon::from_name(dropdown_icon).size(16).symbolic(true))
.align_x(Horizontal::Center) .align_x(Horizontal::Center)
.align_y(Vertical::Center) .align_y(Vertical::Center)
.width(Length::Fixed(24.0)) .width(Length::Fixed(24.0))
@ -468,7 +475,8 @@ impl cosmic::Application for CosmicBluetoothApplet {
]) ])
.on_press(Message::ToggleVisibleDevices(!self.show_visible_devices)); .on_press(Message::ToggleVisibleDevices(!self.show_visible_devices));
if self.bluer_state.bluetooth_enabled { if self.bluer_state.bluetooth_enabled {
content = content.push(padded_control(divider::horizontal::default())); content = content
.push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]));
content = content.push(available_connections_btn); content = content.push(available_connections_btn);
} }
let mut list_column: Vec<Element<'_, Message>> = let mut list_column: Vec<Element<'_, Message>> =
@ -503,7 +511,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
.align_x(Horizontal::Center), .align_x(Horizontal::Center),
padded_control( padded_control(
row![ row![
button( button::custom(
text::body(fl!("cancel")) text::body(fl!("cancel"))
.vertical_alignment(Vertical::Center) .vertical_alignment(Vertical::Center)
.horizontal_alignment(Horizontal::Center) .horizontal_alignment(Horizontal::Center)
@ -512,7 +520,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
.height(Length::Fixed(28.0)) .height(Length::Fixed(28.0))
.width(Length::Fixed(105.0)) .width(Length::Fixed(105.0))
.on_press(Message::Cancel), .on_press(Message::Cancel),
button( button::custom(
text::body(fl!("confirm")) text::body(fl!("confirm"))
.vertical_alignment(Vertical::Center) .vertical_alignment(Vertical::Center)
.horizontal_alignment(Horizontal::Center) .horizontal_alignment(Horizontal::Center)
@ -570,6 +578,9 @@ impl cosmic::Application for CosmicBluetoothApplet {
} else { } else {
content = content.push(Column::with_children(list_column)); content = content.push(Column::with_children(list_column));
} }
// content = content
// .push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]))
// .push(menu_button(text::body(fl!("settings"))).on_press(Message::OpenSettings));
self.core.applet.popup_container(content).into() self.core.applet.popup_container(content).into()
} }

View file

@ -10,6 +10,7 @@ use cosmic::{
app::Core, app::Core,
applet::{self}, applet::{self},
cosmic_config::{self, ConfigSet}, cosmic_config::{self, ConfigSet},
cosmic_theme::Spacing,
iced::{ iced::{
wayland::popup::{destroy_popup, get_popup}, wayland::popup::{destroy_popup, get_popup},
widget::{column, row}, widget::{column, row},
@ -20,6 +21,7 @@ use cosmic::{
iced_runtime::core::window, iced_runtime::core::window,
iced_style::application, iced_style::application,
prelude::*, prelude::*,
theme,
widget::{self, horizontal_space, vertical_space}, widget::{self, horizontal_space, vertical_space},
}; };
use cosmic_comp_config::CosmicCompConfig; use cosmic_comp_config::CosmicCompConfig;
@ -172,7 +174,7 @@ impl cosmic::Application for Window {
.map_or(String::new(), |l| l.layout.clone()), .map_or(String::new(), |l| l.layout.clone()),
); );
cosmic::widget::button( cosmic::widget::button::custom(
row!( row!(
column!( column!(
input_source_text, input_source_text,
@ -200,6 +202,10 @@ impl cosmic::Application for Window {
} }
fn view_window(&self, _id: Id) -> Element<Self::Message> { fn view_window(&self, _id: Id) -> Element<Self::Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let mut content_list = let mut content_list =
widget::column::with_capacity(4 + self.active_layouts.len()).padding([8, 0]); widget::column::with_capacity(4 + self.active_layouts.len()).padding([8, 0]);
for layout in &self.active_layouts { for layout in &self.active_layouts {
@ -212,7 +218,9 @@ impl cosmic::Application for Window {
} }
if !self.active_layouts.is_empty() { if !self.active_layouts.is_empty() {
content_list = content_list.push( content_list = content_list.push(
applet::padded_control(widget::divider::horizontal::default()).apply(Element::from), applet::padded_control(widget::divider::horizontal::default())
.padding([space_xxs, space_s])
.apply(Element::from),
); );
} }
content_list = content_list.push( content_list = content_list.push(

View file

@ -30,7 +30,7 @@ where
) -> Self { ) -> Self {
let border = 1.0; let border = 1.0;
Self { Self {
image_button: button( image_button: button::custom(
container( container(
container(if let Some(img) = img { container(if let Some(img) = img {
let max_dim = img.img.width().max(img.img.height()).max(1); let max_dim = img.img.width().max(img.img.height()).max(1);

View file

@ -1,20 +1,20 @@
network = Network network = Network
airplane-mode = Airplane mode airplane-mode = Airplane mode
airplane-mode-on = Airplane Mode is on airplane-mode-on = Airplane mode is on
turn-off-airplane-mode = Turn off to enable Wi-Fi, Bluetooth and mobile broadband. turn-off-airplane-mode = Turn off to enable Wi-Fi, Bluetooth and mobile broadband.
wifi = Wi-Fi wifi = Wi-Fi
ipv4 = IPv4 Address ipv4 = IPv4 address
ipv6 = IPv6 Address ipv6 = IPv6 address
mac = MAC mac = MAC
megabits-per-second = Mbps megabits-per-second = Mbps
connected = Connected connected = Connected
connecting = Connecting connecting = Connecting
connect = Connect connect = Connect
cancel = Cancel cancel = Cancel
settings = Network Settings... settings = Network settings...
visible-wireless-networks = Visible Wireless Networks visible-wireless-networks = Visible wireless networks
enter-password = Enter the password or encryption key enter-password = Enter the password or encryption key
router-wps-button = You can also connect by pressing the "WPS" button on the router router-wps-button = You can also connect by pressing the "WPS" button on the router
unable-to-connect = Unable to connect to network unable-to-connect = Unable to connect to network
check-wifi-connection = Make sure Wi-Fi is connected to the internet and the password is correct check-wifi-connection = Make sure Wi-Fi is connected to the internet and the password is correct
reset = Reset reset = Reset

View file

@ -7,6 +7,7 @@ use cosmic::{
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate}, token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
}, },
cctk::sctk::reexports::calloop, cctk::sctk::reexports::calloop,
cosmic_theme::Spacing,
iced::{ iced::{
wayland::popup::{destroy_popup, get_popup}, wayland::popup::{destroy_popup, get_popup},
widget::{column, row}, widget::{column, row},
@ -19,6 +20,7 @@ use cosmic::{
}, },
iced_style::application, iced_style::application,
iced_widget::Row, iced_widget::Row,
theme,
widget::{ widget::{
button, container, divider, icon, icon::from_name, scrollable, text, text_input, Column, button, container, divider, icon, icon::from_name, scrollable, text, text_input, Column,
}, },
@ -548,6 +550,10 @@ impl cosmic::Application for CosmicNetworkApplet {
} }
fn view_window(&self, _id: window::Id) -> Element<Message> { fn view_window(&self, _id: window::Id) -> Element<Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let mut vpn_ethernet_col = column![]; let mut vpn_ethernet_col = column![];
let mut known_wifi = Vec::new(); let mut known_wifi = Vec::new();
for conn in &self.nm_state.active_conns { for conn in &self.nm_state.active_conns {
@ -574,7 +580,8 @@ impl cosmic::Application for CosmicNetworkApplet {
.align_items(Alignment::Center) .align_items(Alignment::Center)
.spacing(8) .spacing(8)
.padding(menu_control_padding()), .padding(menu_control_padding()),
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default())
.padding([space_xxs, space_s]),
]); ]);
} }
ActiveConnectionInfo::Wired { ActiveConnectionInfo::Wired {
@ -609,7 +616,8 @@ impl cosmic::Application for CosmicNetworkApplet {
.align_items(Alignment::Center) .align_items(Alignment::Center)
.spacing(8) .spacing(8)
.padding(menu_control_padding()), .padding(menu_control_padding()),
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default())
.padding([space_xxs, space_s]),
]); ]);
} }
ActiveConnectionInfo::WiFi { ActiveConnectionInfo::WiFi {
@ -687,7 +695,7 @@ impl cosmic::Application for CosmicNetworkApplet {
.text_size(14) .text_size(14)
.width(Length::Fill) .width(Length::Fill)
), ),
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control( padded_control(
anim!( anim!(
//toggler //toggler
@ -705,7 +713,7 @@ impl cosmic::Application for CosmicNetworkApplet {
if self.nm_state.airplane_mode { if self.nm_state.airplane_mode {
content = content.push( content = content.push(
column!( column!(
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
icon::from_name("airplane-mode-symbolic") icon::from_name("airplane-mode-symbolic")
.size(48) .size(48)
.symbolic(true), .symbolic(true),
@ -719,7 +727,9 @@ impl cosmic::Application for CosmicNetworkApplet {
); );
} else { } else {
if self.nm_state.wifi_enabled { if self.nm_state.wifi_enabled {
content = content.push(padded_control(divider::horizontal::default())); content = content.push(
padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
);
for known in &self.nm_state.known_access_points { for known in &self.nm_state.known_access_points {
let mut btn_content = Vec::with_capacity(2); let mut btn_content = Vec::with_capacity(2);
let ssid = text::body(&known.ssid).width(Length::Fill); let ssid = text::body(&known.ssid).width(Length::Fill);
@ -790,19 +800,23 @@ impl cosmic::Application for CosmicNetworkApplet {
let has_known_wifi = !known_wifi.is_empty(); let has_known_wifi = !known_wifi.is_empty();
content = content.push(Column::with_children(known_wifi)); content = content.push(Column::with_children(known_wifi));
if has_known_wifi { if has_known_wifi {
content = content.push(padded_control(divider::horizontal::default())); content = content.push(
padded_control(divider::horizontal::default())
.padding([space_xxs, space_s]),
);
} }
let dropdown_icon = if self.show_visible_networks { let dropdown_icon = if self.show_visible_networks {
"go-down-symbolic" "go-up-symbolic"
} else { } else {
"go-next-symbolic" "go-down-symbolic"
}; };
let available_connections_btn = menu_button(row![ let available_connections_btn = menu_button(row![
text::body(fl!("visible-wireless-networks")) text::body(fl!("visible-wireless-networks"))
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fixed(24.0))
.vertical_alignment(Vertical::Center), .vertical_alignment(Vertical::Center),
container(icon::from_name(dropdown_icon).size(14).symbolic(true)) container(icon::from_name(dropdown_icon).size(16).symbolic(true))
.align_x(Horizontal::Center) .align_x(Horizontal::Center)
.align_y(Vertical::Center) .align_y(Vertical::Center)
.width(Length::Fixed(24.0)) .width(Length::Fixed(24.0))
@ -935,6 +949,9 @@ impl cosmic::Application for CosmicNetworkApplet {
.push(scrollable(Column::with_children(list_col)).height(Length::Fixed(300.0))); .push(scrollable(Column::with_children(list_col)).height(Length::Fixed(300.0)));
} }
} }
content = content
.push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]))
.push(menu_button(text::body(fl!("settings"))).on_press(Message::OpenSettings));
self.core self.core
.applet .applet

View file

@ -10,6 +10,7 @@ use cosmic::{
}, },
cctk::sctk::reexports::calloop, cctk::sctk::reexports::calloop,
cosmic_config::{Config, CosmicConfigEntry}, cosmic_config::{Config, CosmicConfigEntry},
cosmic_theme::Spacing,
iced::{ iced::{
wayland::popup::{destroy_popup, get_popup}, wayland::popup::{destroy_popup, get_popup},
widget::{column, row}, widget::{column, row},
@ -17,6 +18,7 @@ use cosmic::{
}, },
iced_core::alignment::Horizontal, iced_core::alignment::Horizontal,
iced_widget::{scrollable, Column}, iced_widget::{scrollable, Column},
theme,
widget::{button, container, divider, icon, text}, widget::{button, container, divider, icon, text},
Command, Element, Theme, Command, Element, Theme,
}; };
@ -364,6 +366,10 @@ impl cosmic::Application for Notifications {
} }
fn view_window(&self, _id: window::Id) -> Element<Message> { fn view_window(&self, _id: window::Id) -> Element<Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let do_not_disturb = padded_control(row![anim!( let do_not_disturb = padded_control(row![anim!(
DO_NOT_DISTURB, DO_NOT_DISTURB,
&self.timeline, &self.timeline,
@ -421,7 +427,7 @@ impl cosmic::Application for Notifications {
let duration_since = text::caption(duration_ago_msg(n)); let duration_since = text::caption(duration_ago_msg(n));
let close_notif = button( let close_notif = button::custom(
icon::from_name("window-close-symbolic") icon::from_name("window-close-symbolic")
.size(16) .size(16)
.symbolic(true), .symbolic(true),
@ -535,7 +541,7 @@ impl cosmic::Application for Notifications {
}; };
let main_content = column![ let main_content = column![
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
notifications, notifications,
]; ];

View file

@ -6,6 +6,7 @@ use std::{collections::HashMap, process, time::Duration};
use cosmic::{ use cosmic::{
app::Command, app::Command,
applet::{menu_button, padded_control}, applet::{menu_button, padded_control},
cosmic_theme::Spacing,
iced, iced,
iced::{ iced::{
alignment::{Horizontal, Vertical}, alignment::{Horizontal, Vertical},
@ -247,6 +248,13 @@ impl cosmic::Application for Power {
} }
fn view_window(&self, id: window::Id) -> Element<Message> { fn view_window(&self, id: window::Id) -> Element<Message> {
let Spacing {
space_xxs,
space_s,
space_m,
..
} = theme::active().cosmic().spacing;
if matches!(self.popup, Some(p) if p == id) { if matches!(self.popup, Some(p) if p == id) {
let settings = menu_button(text::body(fl!("settings"))).on_press(Message::Settings); let settings = menu_button(text::body(fl!("settings"))).on_press(Message::Settings);
@ -259,7 +267,7 @@ impl cosmic::Application for Power {
text::body(fl!("lock-screen-shortcut")), text::body(fl!("lock-screen-shortcut")),
] ]
.align_items(Alignment::Center) .align_items(Alignment::Center)
.spacing(8) .spacing(space_xxs)
) )
.on_press(Message::Action(PowerAction::Lock)), .on_press(Message::Action(PowerAction::Lock)),
menu_button( menu_button(
@ -270,7 +278,7 @@ impl cosmic::Application for Power {
text::body(fl!("log-out-shortcut")), text::body(fl!("log-out-shortcut")),
] ]
.align_items(Alignment::Center) .align_items(Alignment::Center)
.spacing(8) .spacing(space_xxs)
) )
.on_press(Message::Action(PowerAction::LogOut)), .on_press(Message::Action(PowerAction::LogOut)),
]; ];
@ -283,14 +291,14 @@ impl cosmic::Application for Power {
power_buttons("system-shutdown-symbolic", fl!("shutdown")) power_buttons("system-shutdown-symbolic", fl!("shutdown"))
.on_press(Message::Action(PowerAction::Shutdown)), .on_press(Message::Action(PowerAction::Shutdown)),
] ]
.spacing(24) .spacing(space_m)
.padding([0, 24]); .padding([0, space_m]);
let content = column![ let content = column![
settings, settings,
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
session, session,
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
power power
] ]
.align_items(Alignment::Start) .align_items(Alignment::Start)
@ -319,7 +327,7 @@ impl cosmic::Application for Power {
HashMap::from_iter(vec![("action", action), ("countdown", countdown)]) HashMap::from_iter(vec![("action", action), ("countdown", countdown)])
)) ))
.primary_action( .primary_action(
button(min_width_and_height( button::custom(min_width_and_height(
text::body(fl!("confirm", HashMap::from_iter(vec![("action", action)]))) text::body(fl!("confirm", HashMap::from_iter(vec![("action", action)])))
.into(), .into(),
142.0, 142.0,
@ -331,7 +339,7 @@ impl cosmic::Application for Power {
.on_press(Message::Confirm), .on_press(Message::Confirm),
) )
.secondary_action( .secondary_action(
button(min_width_and_height( button::custom(min_width_and_height(
text::body(fl!("cancel")).into(), text::body(fl!("cancel")).into(),
142.0, 142.0,
32.0, 32.0,
@ -380,7 +388,7 @@ impl cosmic::Application for Power {
} }
fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message> { fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message> {
cosmic::widget::button( button::custom(
column![text_icon(name, 40), text::body(msg)] column![text_icon(name, 40), text::body(msg)]
.spacing(4) .spacing(4)
.align_items(Alignment::Center) .align_items(Alignment::Center)

View file

@ -7,8 +7,9 @@ use crate::{
use cctk::sctk::reexports::calloop::channel::SyncSender; use cctk::sctk::reexports::calloop::channel::SyncSender;
use cosmic::{ use cosmic::{
app::Core, app::Core,
applet::padded_control, applet::{menu_button, padded_control},
cosmic_config::{Config, ConfigSet, CosmicConfigEntry}, cosmic_config::{Config, ConfigSet, CosmicConfigEntry},
cosmic_theme::Spacing,
iced::{ iced::{
wayland::popup::{destroy_popup, get_popup}, wayland::popup::{destroy_popup, get_popup},
window::Id, window::Id,
@ -16,9 +17,10 @@ use cosmic::{
}, },
iced_style::application, iced_style::application,
iced_widget::{column, row}, iced_widget::{column, row},
theme,
widget::{ widget::{
container, divider, segmented_button, container, divider,
segmented_button::{Entity, SingleSelectModel}, segmented_button::{self, Entity, SingleSelectModel},
segmented_control, spin_button, text, segmented_control, spin_button, text,
}, },
Element, Theme, Element, Theme,
@ -58,6 +60,7 @@ pub enum Message {
MyConfigUpdate(Box<CosmicCompConfig>), MyConfigUpdate(Box<CosmicCompConfig>),
WorkspaceUpdate(WorkspacesUpdate), WorkspaceUpdate(WorkspacesUpdate),
NewWorkspace(Entity), NewWorkspace(Entity),
OpenSettings,
} }
impl cosmic::Application for Window { impl cosmic::Application for Window {
@ -267,6 +270,11 @@ impl cosmic::Application for Window {
} }
}); });
} }
Message::OpenSettings => {
let mut cmd = std::process::Command::new("cosmic-settings");
cmd.arg("window-management");
tokio::spawn(cosmic::process::spawn(cmd));
}
} }
Command::none() Command::none()
} }
@ -280,6 +288,13 @@ impl cosmic::Application for Window {
} }
fn view_window(&self, _id: Id) -> Element<Self::Message> { fn view_window(&self, _id: Id) -> Element<Self::Message> {
let Spacing {
space_xxxs,
space_xxs,
space_s,
..
} = theme::active().cosmic().spacing;
let new_workspace_behavior_button = let new_workspace_behavior_button =
segmented_control::horizontal(&self.new_workspace_behavior_model) segmented_control::horizontal(&self.new_workspace_behavior_model)
.on_activate(Message::NewWorkspace); .on_activate(Message::NewWorkspace);
@ -296,12 +311,15 @@ impl cosmic::Application for Window {
.width(Length::Fill), .width(Length::Fill),
)) ))
.width(Length::Fill), .width(Length::Fill),
padded_control(divider::horizontal::default(),), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control(column![ padded_control(
text::body(fl!("new-workspace")), column![
new_workspace_behavior_button, text::body(fl!("new-workspace")),
]), new_workspace_behavior_button,
padded_control(divider::horizontal::default()), ]
.spacing(space_xxxs)
),
padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control(row!( padded_control(row!(
text::body(fl!("navigate-windows")).width(Length::Fill), text::body(fl!("navigate-windows")).width(Length::Fill),
text::body(format!("{} + {}", fl!("super"), fl!("arrow-keys"))), text::body(format!("{} + {}", fl!("super"), fl!("arrow-keys"))),
@ -319,7 +337,7 @@ impl cosmic::Application for Window {
text::body(fl!("toggle-floating-window")).width(Length::Fill), text::body(fl!("toggle-floating-window")).width(Length::Fill),
text::body(format!("{} + G", fl!("super"))), text::body(format!("{} + G", fl!("super"))),
)), )),
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control( padded_control(
anim!( anim!(
self.active_hint, self.active_hint,
@ -331,6 +349,9 @@ impl cosmic::Application for Window {
.text_size(14) .text_size(14)
.width(Length::Fill), .width(Length::Fill),
), ),
padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
menu_button(text::body(fl!("window-management-settings")))
.on_press(Message::OpenSettings)
] ]
.padding([8, 0]); .padding([8, 0]);

View file

@ -1,13 +1,14 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
use std::{borrow::Cow, str::FromStr}; use std::str::FromStr;
use chrono::{Datelike, Timelike}; use chrono::{Datelike, Timelike};
use cosmic::{ use cosmic::{
app, app,
applet::{cosmic_panel_config::PanelAnchor, menu_button, padded_control}, applet::{cosmic_panel_config::PanelAnchor, menu_button, padded_control},
cctk::sctk::reexports::calloop, cctk::sctk::reexports::calloop,
cosmic_theme::Spacing,
iced::{ iced::{
futures::{channel::mpsc, SinkExt, StreamExt, TryFutureExt}, futures::{channel::mpsc, SinkExt, StreamExt, TryFutureExt},
subscription, subscription,
@ -18,6 +19,7 @@ use cosmic::{
iced_core::alignment::{Horizontal, Vertical}, iced_core::alignment::{Horizontal, Vertical},
iced_style::application, iced_style::application,
iced_widget::{horizontal_rule, Column}, iced_widget::{horizontal_rule, Column},
theme,
widget::{ widget::{
button, container, divider, grid, horizontal_space, icon, rectangle_tracker::*, text, button, container, divider, grid, horizontal_space, icon, rectangle_tracker::*, text,
Button, Grid, Space, Button, Grid, Space,
@ -432,7 +434,7 @@ impl cosmic::Application for Window {
PanelAnchor::Top | PanelAnchor::Bottom PanelAnchor::Top | PanelAnchor::Bottom
); );
let button = cosmic::widget::button(if horizontal { let button = button::custom(if horizontal {
let mut bag = Bag::empty(); let mut bag = Bag::empty();
if self.config.show_date_in_top_panel { if self.config.show_date_in_top_panel {
@ -547,6 +549,10 @@ impl cosmic::Application for Window {
} }
fn view_window(&self, _id: window::Id) -> Element<Message> { fn view_window(&self, _id: window::Id) -> Element<Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let mut date_bag = Bag::empty(); let mut date_bag = Bag::empty();
date_bag.month = Some(components::Month::Long); date_bag.month = Some(components::Month::Long);
date_bag.day = Some(components::Day::NumericDayOfMonth); date_bag.day = Some(components::Day::NumericDayOfMonth);
@ -622,7 +628,7 @@ impl cosmic::Application for Window {
.align_items(Alignment::Center) .align_items(Alignment::Center)
.padding([12, 20]), .padding([12, 20]),
calender.padding([0, 12].into()), calender.padding([0, 12].into()),
padded_control(divider::horizontal::default()), padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
menu_button(text::body(fl!("datetime-settings"))) menu_button(text::body(fl!("datetime-settings")))
.on_press(Message::OpenDateTimeSettings), .on_press(Message::OpenDateTimeSettings),
] ]
@ -641,14 +647,13 @@ impl cosmic::Application for Window {
fn date_button(day: u32, is_month: bool, is_day: bool) -> Button<'static, Message> { fn date_button(day: u32, is_month: bool, is_day: bool) -> Button<'static, Message> {
let style = if is_day { let style = if is_day {
cosmic::widget::button::Style::Suggested button::Style::Suggested
} else { } else {
cosmic::widget::button::Style::Text button::Style::Text
}; };
let button = button( let button = button::custom(
text(format!("{day}")) text::body(format!("{day}"))
.size(14.0)
.horizontal_alignment(Horizontal::Center) .horizontal_alignment(Horizontal::Center)
.vertical_alignment(Vertical::Center), .vertical_alignment(Vertical::Center),
) )

View file

@ -123,7 +123,7 @@ impl cosmic::Application for Button {
)) ))
) )
.align_items(iced::Alignment::Center); .align_items(iced::Alignment::Center);
cosmic::widget::button(content) cosmic::widget::button::custom(content)
.padding([0, self.core.applet.suggested_padding(true)]) .padding([0, self.core.applet.suggested_padding(true)])
.style(cosmic::theme::Button::AppletIcon) .style(cosmic::theme::Button::AppletIcon)
} }