Update libcosmic
This commit is contained in:
parent
3353dc95ac
commit
c7b25daa71
22 changed files with 1049 additions and 715 deletions
122
Cargo.lock
generated
122
Cargo.lock
generated
|
|
@ -856,6 +856,7 @@ dependencies = [
|
|||
name = "cosmic-applet-tiling"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cosmic-time",
|
||||
"i18n-embed 0.14.0",
|
||||
"i18n-embed-fl 0.7.0",
|
||||
"libcosmic",
|
||||
|
|
@ -906,12 +907,26 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"cosmic-config-derive",
|
||||
"cosmic-config-derive 0.1.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"dirs 5.0.1",
|
||||
"iced_futures",
|
||||
"iced_futures 0.7.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"notify",
|
||||
"ron",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b404497e7636d44ba0fffa9b88e26f5b76d2b789"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"cosmic-config-derive 0.1.0 (git+https://github.com/pop-os/libcosmic)",
|
||||
"dirs 5.0.1",
|
||||
"iced_futures 0.7.0 (git+https://github.com/pop-os/libcosmic)",
|
||||
"notify",
|
||||
"ron",
|
||||
"serde",
|
||||
|
|
@ -920,7 +935,16 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b404497e7636d44ba0fffa9b88e26f5b76d2b789"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
|
|
@ -942,16 +966,16 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-notifications-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-notifications#35fd49d2b8147859d8b08d68b346096c356a8d15"
|
||||
source = "git+https://github.com/edfloreshz/cosmic-notifications#58e948e6260d2088a7da9128173c76b9cb6db7f3"
|
||||
dependencies = [
|
||||
"cosmic-config",
|
||||
"cosmic-config 0.1.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-notifications-util"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-notifications#35fd49d2b8147859d8b08d68b346096c356a8d15"
|
||||
source = "git+https://github.com/edfloreshz/cosmic-notifications#58e948e6260d2088a7da9128173c76b9cb6db7f3"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"fast_image_resize",
|
||||
|
|
@ -972,10 +996,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-panel-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#edfd24ed3b712de397057906924e4f7e8b6252c4"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#7b56316ddcdd3e921b61cf3fe3f69b4bcae437d3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cosmic-config",
|
||||
"cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)",
|
||||
"ron",
|
||||
"serde",
|
||||
"tracing",
|
||||
|
|
@ -1019,10 +1043,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-theme"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"almost",
|
||||
"cosmic-config",
|
||||
"cosmic-config 0.1.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"csscolorparser",
|
||||
"lazy_static",
|
||||
"palette",
|
||||
|
|
@ -1033,7 +1057,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-time"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-time#4013946f9bd9d2e53bf44310b7db783fc8105b79"
|
||||
source = "git+https://github.com/edfloreshz/cosmic-time#dfe7211c5c402685cc361b17a148574f37d86df2"
|
||||
dependencies = [
|
||||
"float-cmp",
|
||||
"libcosmic",
|
||||
|
|
@ -2359,11 +2383,11 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"iced_accessibility",
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
"iced_core 0.10.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"iced_futures 0.7.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"iced_renderer",
|
||||
"iced_sctk",
|
||||
"iced_widget",
|
||||
|
|
@ -2374,7 +2398,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_accessibility"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_unix",
|
||||
|
|
@ -2383,7 +2407,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"iced_accessibility",
|
||||
|
|
@ -2395,29 +2419,53 @@ dependencies = [
|
|||
"twox-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b404497e7636d44ba0fffa9b88e26f5b76d2b789"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"instant",
|
||||
"log",
|
||||
"thiserror",
|
||||
"twox-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core",
|
||||
"iced_core 0.10.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"log",
|
||||
"tokio",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-timer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b404497e7636d44ba0fffa9b88e26f5b76d2b789"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core 0.10.0 (git+https://github.com/pop-os/libcosmic)",
|
||||
"log",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-timer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iced_graphics"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bytemuck",
|
||||
"glam",
|
||||
"half",
|
||||
"iced_core",
|
||||
"iced_core 0.10.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"image",
|
||||
"kamadak-exif",
|
||||
"log",
|
||||
|
|
@ -2428,7 +2476,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_renderer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"iced_graphics",
|
||||
"iced_tiny_skia",
|
||||
|
|
@ -2441,11 +2489,11 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_runtime"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"iced_accessibility",
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
"iced_core 0.10.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"iced_futures 0.7.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"smithay-client-toolkit 0.17.0",
|
||||
"thiserror",
|
||||
]
|
||||
|
|
@ -2453,12 +2501,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_sctk"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"enum-repr",
|
||||
"float-cmp",
|
||||
"futures",
|
||||
"iced_futures",
|
||||
"iced_futures 0.7.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"iced_graphics",
|
||||
"iced_runtime",
|
||||
"iced_style",
|
||||
|
|
@ -2475,9 +2523,9 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_style"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"iced_core 0.10.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"once_cell",
|
||||
"palette",
|
||||
]
|
||||
|
|
@ -2485,7 +2533,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_tiny_skia"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cosmic-text",
|
||||
|
|
@ -2503,7 +2551,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_wgpu"
|
||||
version = "0.11.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bytemuck",
|
||||
|
|
@ -2524,7 +2572,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_widget"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"iced_renderer",
|
||||
"iced_runtime",
|
||||
|
|
@ -2790,19 +2838,19 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
|||
[[package]]
|
||||
name = "libcosmic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#fcdefcd8fbca53705ba761b97e25453bc35e40c0"
|
||||
source = "git+https://github.com/edfloreshz/libcosmic#5167c6ba4b155d8110415e1bb53247f1445a95ae"
|
||||
dependencies = [
|
||||
"apply",
|
||||
"ashpd",
|
||||
"cosmic-config",
|
||||
"cosmic-config 0.1.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"cosmic-panel-config",
|
||||
"cosmic-theme",
|
||||
"derive_setters",
|
||||
"fraction",
|
||||
"freedesktop-icons",
|
||||
"iced",
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
"iced_core 0.10.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"iced_futures 0.7.0 (git+https://github.com/edfloreshz/libcosmic)",
|
||||
"iced_renderer",
|
||||
"iced_runtime",
|
||||
"iced_sctk",
|
||||
|
|
@ -5790,7 +5838,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "xdg-shell-wrapper-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/xdg-shell-wrapper#9ae1c4c838fe58e887b62d2a990d73ab2f6cb629"
|
||||
source = "git+https://github.com/pop-os/xdg-shell-wrapper#5acfa50fc458ffc68a800d9b42ce34dea3a7bece"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"wayland-protocols-wlr",
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-c
|
|||
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = [
|
||||
"client",
|
||||
], rev = "e39748e" }
|
||||
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", default-features = false, features = [
|
||||
cosmic-time = { git = "https://github.com/edfloreshz/cosmic-time", default-features = false, features = [
|
||||
"libcosmic",
|
||||
"once_cell",
|
||||
] }
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = [
|
||||
libcosmic = { git = "https://github.com/edfloreshz/libcosmic", default-features = false, features = [
|
||||
"applet",
|
||||
"tokio",
|
||||
"wayland",
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ use itertools::Itertools;
|
|||
use rand::{thread_rng, Rng};
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
|
|
@ -114,10 +113,9 @@ impl DockItem {
|
|||
..
|
||||
} = self;
|
||||
|
||||
let cosmic_icon = cosmic::widget::icon(
|
||||
Path::new(&desktop_info.icon),
|
||||
applet_helper.suggested_size().0,
|
||||
);
|
||||
let cosmic_icon = cosmic::widget::icon::from_path(PathBuf::from(&desktop_info.icon))
|
||||
.icon()
|
||||
.size(applet_helper.suggested_size().0);
|
||||
|
||||
let dot_radius = 2;
|
||||
let dots = (0..toplevels.len())
|
||||
|
|
@ -134,12 +132,13 @@ impl DockItem {
|
|||
border_radius: 4.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
icon_color: Some(Color::TRANSPARENT),
|
||||
},
|
||||
)))
|
||||
.into()
|
||||
})
|
||||
.collect_vec();
|
||||
let icon_wrapper = match applet_helper.anchor {
|
||||
let icon_wrapper: Element<_> = match applet_helper.anchor {
|
||||
PanelAnchor::Left => row(vec![column(dots).spacing(4).into(), cosmic_icon.into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
|
|
@ -158,8 +157,8 @@ impl DockItem {
|
|||
.into(),
|
||||
};
|
||||
|
||||
let icon_button = cosmic::widget::button(Button::Text)
|
||||
.custom(vec![icon_wrapper])
|
||||
let icon_button = cosmic::widget::button(icon_wrapper)
|
||||
.style(Button::Text)
|
||||
.padding(8);
|
||||
let icon_button = if interaction_enabled {
|
||||
dnd_source(
|
||||
|
|
@ -879,10 +878,10 @@ impl cosmic::Application for CosmicAppList {
|
|||
} else if self.is_listening_for_dnd && self.favorite_list.is_empty() {
|
||||
// show star indicating favorite_list is drag target
|
||||
favorites.push(
|
||||
container(cosmic::widget::icon(
|
||||
"starred-symbolic.symbolic",
|
||||
self.core.applet_helper.suggested_size().0,
|
||||
))
|
||||
container(
|
||||
cosmic::widget::icon::from_name("starred-symbolic.symbolic")
|
||||
.size(self.core.applet_helper.suggested_size().0),
|
||||
)
|
||||
.padding(8)
|
||||
.into(),
|
||||
);
|
||||
|
|
@ -962,11 +961,11 @@ impl cosmic::Application for CosmicAppList {
|
|||
} else if !self.active_list.is_empty() {
|
||||
vec![active]
|
||||
} else {
|
||||
vec![cosmic::widget::icon(
|
||||
"com.system76.CosmicAppList",
|
||||
self.core.applet_helper.suggested_size().0,
|
||||
)
|
||||
.into()]
|
||||
vec![
|
||||
cosmic::widget::icon::from_name("com.system76.CosmicAppList")
|
||||
.size(self.core.applet_helper.suggested_size().0)
|
||||
.into(),
|
||||
]
|
||||
};
|
||||
|
||||
let content = match &self.core.applet_helper.anchor {
|
||||
|
|
@ -997,10 +996,9 @@ impl cosmic::Application for CosmicAppList {
|
|||
|
||||
fn view_window(&self, id: window::Id) -> Element<Message> {
|
||||
if let Some((_, item, _)) = self.dnd_source.as_ref().filter(|s| s.0 == id) {
|
||||
cosmic::widget::icon(
|
||||
Path::new(&item.desktop_info.icon),
|
||||
self.core.applet_helper.suggested_size().0,
|
||||
)
|
||||
cosmic::widget::icon::from_path(PathBuf::from(&item.desktop_info.icon))
|
||||
.icon()
|
||||
.size(self.core.applet_helper.suggested_size().0)
|
||||
.into()
|
||||
} else if let Some((
|
||||
_popup_id,
|
||||
|
|
@ -1019,8 +1017,8 @@ impl cosmic::Application for CosmicAppList {
|
|||
|
||||
let mut content = column![
|
||||
iced::widget::text(&desktop_info.name).horizontal_alignment(Horizontal::Center),
|
||||
cosmic::widget::button(Button::Text)
|
||||
.custom(vec![iced::widget::text(fl!("new-window")).into()])
|
||||
cosmic::widget::button(iced::widget::text(fl!("new-window")))
|
||||
.style(Button::Text)
|
||||
.on_press(Message::Exec(desktop_info.exec.clone())),
|
||||
]
|
||||
.padding(8)
|
||||
|
|
@ -1035,8 +1033,8 @@ impl cosmic::Application for CosmicAppList {
|
|||
info.title.clone()
|
||||
};
|
||||
list_col = list_col.push(
|
||||
cosmic::widget::button(Button::Text)
|
||||
.custom(vec![iced::widget::text(title).into()])
|
||||
cosmic::widget::button(iced::widget::text(title))
|
||||
.style(Button::Text)
|
||||
.on_press(Message::Activate(handle.clone())),
|
||||
);
|
||||
}
|
||||
|
|
@ -1045,25 +1043,25 @@ impl cosmic::Application for CosmicAppList {
|
|||
content = content.push(divider::horizontal::light());
|
||||
}
|
||||
content = content.push(if is_favorite {
|
||||
cosmic::widget::button(Button::Text)
|
||||
.custom(vec![iced::widget::text(fl!("unfavorite")).into()])
|
||||
cosmic::widget::button(iced::widget::text(fl!("unfavorite")))
|
||||
.style(Button::Text)
|
||||
.on_press(Message::UnFavorite(desktop_info.id.clone()))
|
||||
} else {
|
||||
cosmic::widget::button(Button::Text)
|
||||
.custom(vec![iced::widget::text(fl!("favorite")).into()])
|
||||
cosmic::widget::button(iced::widget::text(fl!("favorite")))
|
||||
.style(Button::Text)
|
||||
.on_press(Message::Favorite(desktop_info.id.clone()))
|
||||
});
|
||||
|
||||
content = match toplevels.len() {
|
||||
0 => content,
|
||||
1 => content.push(
|
||||
cosmic::widget::button(Button::Text)
|
||||
.custom(vec![iced::widget::text(fl!("quit")).into()])
|
||||
cosmic::widget::button(iced::widget::text(fl!("quit")))
|
||||
.style(Button::Text)
|
||||
.on_press(Message::Quit(desktop_info.id.clone())),
|
||||
),
|
||||
_ => content.push(
|
||||
cosmic::widget::button(Button::Text)
|
||||
.custom(vec![iced::widget::text(&fl!("quit-all")).into()])
|
||||
cosmic::widget::button(iced::widget::text(&fl!("quit-all")))
|
||||
.style(Button::Text)
|
||||
.on_press(Message::Quit(desktop_info.id.clone())),
|
||||
),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use cosmic::app::Command;
|
|||
use cosmic::iced::widget;
|
||||
use cosmic::iced::Limits;
|
||||
use cosmic::iced_runtime::core::alignment::Horizontal;
|
||||
use cosmic::theme::Svg;
|
||||
|
||||
use cosmic::app::applet::applet_button_theme;
|
||||
use cosmic::widget::{button, divider, icon};
|
||||
|
|
@ -370,7 +369,9 @@ impl cosmic::Application for Audio {
|
|||
} else {
|
||||
column![
|
||||
row![
|
||||
icon(self.icon_name.as_str(), 24).style(Svg::Symbolic),
|
||||
icon::from_name(self.icon_name.as_str())
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
slider(0.0..=100.0, out_f64, Message::SetOutputVolume)
|
||||
.width(Length::FillPortion(5)),
|
||||
text(format!("{}%", out_f64.round()))
|
||||
|
|
@ -382,7 +383,9 @@ impl cosmic::Application for Audio {
|
|||
.align_items(Alignment::Center)
|
||||
.padding([8, 24]),
|
||||
row![
|
||||
icon(self.input_icon_name.as_str(), 24).style(Svg::Symbolic),
|
||||
icon::from_name(self.input_icon_name.as_str())
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
slider(0.0..=100.0, in_f64, Message::SetInputVolume)
|
||||
.width(Length::FillPortion(5)),
|
||||
text(format!("{}%", in_f64.round()))
|
||||
|
|
@ -455,8 +458,8 @@ impl cosmic::Application for Audio {
|
|||
container(divider::horizontal::light())
|
||||
.padding([12, 24])
|
||||
.width(Length::Fill),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![text(fl!("sound-settings")).size(14).into()])
|
||||
button(text(fl!("sound-settings")).size(14))
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.width(Length::Fill)
|
||||
]
|
||||
|
|
@ -487,8 +490,8 @@ fn revealer(
|
|||
column![revealer_head(open, title, selected, toggle)].width(Length::Fill),
|
||||
|col, (id, name)| {
|
||||
col.push(
|
||||
button(applet_button_theme())
|
||||
.custom(vec![text(name).size(14).into()])
|
||||
button(text(name).size(14))
|
||||
.style(applet_button_theme())
|
||||
.on_press(change(id.clone()))
|
||||
.width(Length::Fill)
|
||||
.padding([8, 48]),
|
||||
|
|
@ -505,12 +508,12 @@ fn revealer_head(
|
|||
title: String,
|
||||
selected: String,
|
||||
toggle: Message,
|
||||
) -> widget::Button<'static, Message, Renderer> {
|
||||
button(applet_button_theme())
|
||||
.custom(vec![
|
||||
text(title).width(Length::Fill).size(14).into(),
|
||||
text(selected).size(10).into(),
|
||||
) -> cosmic::widget::Button<'static, Message, Renderer> {
|
||||
button(column![
|
||||
text(title).width(Length::Fill).size(14),
|
||||
text(selected).size(10),
|
||||
])
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.width(Length::Fill)
|
||||
.on_press(toggle)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ use cosmic::iced::{
|
|||
};
|
||||
use cosmic::iced_runtime::core::layout::Limits;
|
||||
use cosmic::iced_style::application;
|
||||
use cosmic::theme::Svg;
|
||||
use cosmic::widget::{button, divider, icon};
|
||||
use cosmic::{Element, Theme};
|
||||
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
|
||||
|
|
@ -309,7 +308,7 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
.popup_container(
|
||||
column![
|
||||
row![
|
||||
icon(&*self.icon_name, 24).style(Svg::Symbolic),
|
||||
icon::from_name(&*self.icon_name).size(24).symbolic(true),
|
||||
column![name, description]
|
||||
]
|
||||
.padding([0, 24])
|
||||
|
|
@ -318,60 +317,54 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
container(divider::horizontal::light())
|
||||
.width(Length::Fill)
|
||||
.padding([0, 12]),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
button(
|
||||
row![
|
||||
column![
|
||||
text(fl!("battery")).size(14),
|
||||
text(fl!("battery-desc")).size(10)
|
||||
]
|
||||
.width(Length::Fill),
|
||||
icon("emblem-ok-symbolic", 12).size(12).style(
|
||||
match self.power_profile {
|
||||
Power::Battery => Svg::SymbolicActive,
|
||||
_ => Svg::Default,
|
||||
}
|
||||
),
|
||||
icon::from_name("emblem-ok-symbolic")
|
||||
.size(12)
|
||||
.symbolic(matches!(self.power_profile, Power::Battery)),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectProfile(Power::Battery))
|
||||
.width(Length::Fill),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
button(
|
||||
row![
|
||||
column![
|
||||
text(fl!("balanced")).size(14),
|
||||
text(fl!("balanced-desc")).size(10)
|
||||
]
|
||||
.width(Length::Fill),
|
||||
icon("emblem-ok-symbolic", 12).size(12).style(
|
||||
match self.power_profile {
|
||||
Power::Balanced => Svg::SymbolicActive,
|
||||
_ => Svg::Default,
|
||||
}
|
||||
),
|
||||
icon::from_name("emblem-ok-symbolic")
|
||||
.size(12)
|
||||
.symbolic(matches!(self.power_profile, Power::Balanced)),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectProfile(Power::Balanced))
|
||||
.width(Length::Fill),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
button(
|
||||
row![
|
||||
column![
|
||||
text(fl!("performance")).size(14),
|
||||
text(fl!("performance-desc")).size(10)
|
||||
]
|
||||
.width(Length::Fill),
|
||||
icon("emblem-ok-symbolic", 12).size(12).style(
|
||||
match self.power_profile {
|
||||
Power::Performance => Svg::SymbolicActive,
|
||||
_ => Svg::Default,
|
||||
}
|
||||
),
|
||||
icon::from_name("emblem-ok-symbolic")
|
||||
.size(12)
|
||||
.symbolic(matches!(self.power_profile, Power::Performance)),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectProfile(Power::Performance))
|
||||
.width(Length::Fill),
|
||||
|
|
@ -396,7 +389,9 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
.width(Length::Fill)
|
||||
.padding([0, 12]),
|
||||
row![
|
||||
icon(self.display_icon_name.as_str(), 24).style(Svg::Symbolic),
|
||||
icon::from_name(self.display_icon_name.as_str())
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
slider(
|
||||
1..=100,
|
||||
(self.screen_brightness * 100.0) as i32,
|
||||
|
|
@ -410,7 +405,9 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
.padding([0, 24])
|
||||
.spacing(12),
|
||||
row![
|
||||
icon("keyboard-brightness-symbolic", 24).style(Svg::Symbolic),
|
||||
icon::from_name("keyboard-brightness-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
slider(
|
||||
0..=100,
|
||||
(self.kbd_brightness * 100.0) as i32,
|
||||
|
|
@ -426,11 +423,8 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
container(divider::horizontal::light())
|
||||
.width(Length::Fill)
|
||||
.padding([0, 12]),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![text(fl!("power-settings"))
|
||||
.size(14)
|
||||
.width(Length::Fill)
|
||||
.into()])
|
||||
button(text(fl!("power-settings")).size(14).width(Length::Fill))
|
||||
.style(applet_button_theme())
|
||||
.on_press(Message::OpenBatterySettings)
|
||||
.width(Length::Fill)
|
||||
.padding([8, 24])
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::bluetooth::{BluerDeviceStatus, BluerRequest, BluerState};
|
||||
use cosmic::app::{applet::applet_button_theme, Command};
|
||||
use cosmic::iced_style;
|
||||
use cosmic::widget::button::StyleSheet;
|
||||
use cosmic::{
|
||||
iced::{
|
||||
self,
|
||||
|
|
@ -13,8 +13,8 @@ use cosmic::{
|
|||
layout::Limits,
|
||||
window,
|
||||
},
|
||||
iced_style::{application, button::StyleSheet},
|
||||
theme::{Button, Svg},
|
||||
iced_style::application,
|
||||
theme::Button,
|
||||
widget::{button, divider, icon, toggler},
|
||||
Element, Theme,
|
||||
};
|
||||
|
|
@ -291,13 +291,21 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
|
||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||
let button_style = || Button::Custom {
|
||||
active: Box::new(|t| iced_style::button::Appearance {
|
||||
active: Box::new(|active, t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.active(&Button::Text)
|
||||
..t.active(active, &Button::Standard)
|
||||
}),
|
||||
hover: Box::new(|t| iced_style::button::Appearance {
|
||||
disabled: Box::new(|t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.hovered(&Button::Text)
|
||||
..t.disabled(&Button::Text)
|
||||
}),
|
||||
hovered: Box::new(|hovered, t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.hovered(hovered, &Button::Text)
|
||||
}),
|
||||
pressed: Box::new(|pressed, t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.pressed(pressed, &Button::Text)
|
||||
}),
|
||||
};
|
||||
let mut known_bluetooth = column![];
|
||||
|
|
@ -308,7 +316,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
.map_or(false, |(dev, _, _)| d.address == dev.address)
|
||||
}) {
|
||||
let mut row = row![
|
||||
icon(dev.icon.as_str(), 16).style(Svg::Symbolic),
|
||||
icon::from_name(dev.icon.as_str()).size(16).symbolic(true),
|
||||
text(dev.name.clone())
|
||||
.size(14)
|
||||
.horizontal_alignment(Horizontal::Left)
|
||||
|
|
@ -329,14 +337,17 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
}
|
||||
BluerDeviceStatus::Paired => {}
|
||||
BluerDeviceStatus::Connecting | BluerDeviceStatus::Disconnecting => {
|
||||
row = row.push(icon("process-working-symbolic", 24).style(Svg::Symbolic));
|
||||
row = row.push(
|
||||
icon::from_name("process-working-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
);
|
||||
}
|
||||
BluerDeviceStatus::Disconnected | BluerDeviceStatus::Pairing => continue,
|
||||
};
|
||||
|
||||
known_bluetooth = known_bluetooth.push(
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row.into()])
|
||||
button(row)
|
||||
.style(applet_button_theme())
|
||||
.on_press(match dev.status {
|
||||
BluerDeviceStatus::Connected => {
|
||||
|
|
@ -390,24 +401,19 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
} else {
|
||||
"go-next-symbolic"
|
||||
};
|
||||
let available_connections_btn = button(Button::Secondary)
|
||||
.custom(
|
||||
vec![
|
||||
let available_connections_btn = button(row![
|
||||
text(fl!("other-devices"))
|
||||
.size(14)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fixed(24.0))
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.into(),
|
||||
container(icon(dropdown_icon, 14).style(Svg::Symbolic))
|
||||
.vertical_alignment(Vertical::Center),
|
||||
container(icon::from_name(dropdown_icon).size(14).symbolic(true))
|
||||
.align_x(Horizontal::Center)
|
||||
.align_y(Vertical::Center)
|
||||
.width(Length::Fixed(24.0))
|
||||
.height(Length::Fixed(24.0))
|
||||
.into(),
|
||||
]
|
||||
.into(),
|
||||
)
|
||||
])
|
||||
.style(Button::Standard)
|
||||
.padding([8, 24])
|
||||
.style(button_style())
|
||||
.on_press(Message::ToggleVisibleDevices(!self.show_visible_devices));
|
||||
|
|
@ -417,7 +423,9 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
|
||||
if let Some((device, pin, _)) = self.request_confirmation.as_ref() {
|
||||
let row = column![
|
||||
icon(device.icon.as_str(), 16).style(Svg::Symbolic),
|
||||
icon::from_name(device.icon.as_str())
|
||||
.size(16)
|
||||
.symbolic(true),
|
||||
text(&device.name)
|
||||
.size(14)
|
||||
.horizontal_alignment(Horizontal::Left)
|
||||
|
|
@ -437,29 +445,23 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
.width(Length::Fill)
|
||||
.size(22),
|
||||
row![
|
||||
button(Button::Secondary)
|
||||
.custom(
|
||||
vec![text(fl!("cancel"))
|
||||
button(
|
||||
text(fl!("cancel"))
|
||||
.size(14)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fixed(24.0))
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.into(),]
|
||||
.into(),
|
||||
)
|
||||
.padding([8, 24])
|
||||
.style(button_style())
|
||||
.on_press(Message::Cancel)
|
||||
.width(Length::Fill),
|
||||
button(Button::Secondary)
|
||||
.custom(
|
||||
vec![text(fl!("confirm"))
|
||||
button(
|
||||
text(fl!("confirm"))
|
||||
.size(14)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fixed(24.0))
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.into(),]
|
||||
.into(),
|
||||
)
|
||||
.padding([8, 24])
|
||||
.style(button_style())
|
||||
|
|
@ -472,8 +474,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
list_column.push(row.into());
|
||||
}
|
||||
let mut visible_devices_count = 0;
|
||||
if self.show_visible_devices {
|
||||
if self.bluer_state.bluetooth_enabled {
|
||||
if self.show_visible_devices && self.bluer_state.bluetooth_enabled {
|
||||
let mut visible_devices = column![];
|
||||
for dev in self.bluer_state.devices.iter().filter(|d| {
|
||||
matches!(
|
||||
|
|
@ -485,7 +486,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
.map_or(false, |(dev, _, _)| d.address == dev.address)
|
||||
}) {
|
||||
let row = row![
|
||||
icon(dev.icon.as_str(), 16).style(Svg::Symbolic),
|
||||
icon::from_name(dev.icon.as_str()).size(16).symbolic(true),
|
||||
text(dev.name.clone())
|
||||
.horizontal_alignment(Horizontal::Left)
|
||||
.size(14),
|
||||
|
|
@ -494,8 +495,8 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
.align_items(Alignment::Center)
|
||||
.spacing(12);
|
||||
visible_devices = visible_devices.push(
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row.width(Length::Fill).into()])
|
||||
button(row.width(Length::Fill))
|
||||
.style(applet_button_theme())
|
||||
.on_press(Message::Request(BluerRequest::PairDevice(
|
||||
dev.address.clone(),
|
||||
)))
|
||||
|
|
@ -505,7 +506,6 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
}
|
||||
list_column.push(visible_devices.into());
|
||||
}
|
||||
}
|
||||
let item_counter = visible_devices_count
|
||||
// request confirmation is pretty big
|
||||
+ if self.request_confirmation.is_some() {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,10 @@ pub async fn init() -> Option<(Connection, PowerDaemonProxy<'static>)> {
|
|||
_ => return None,
|
||||
};
|
||||
|
||||
if matches!(proxy.introspect().await, Err(zbus::fdo::Error::ServiceUnknown(_))) {
|
||||
if matches!(
|
||||
proxy.introspect().await,
|
||||
Err(zbus::fdo::Error::ServiceUnknown(_))
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,7 @@ mod window;
|
|||
use window::*;
|
||||
|
||||
pub fn main() -> cosmic::iced::Result {
|
||||
localize::localize();
|
||||
|
||||
cosmic::app::applet::run::<Window>(true, ())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use cosmic::{
|
|||
iced::widget::{column, container, row, text},
|
||||
iced::{self, Length},
|
||||
iced_runtime::core::window,
|
||||
theme::{Svg, Theme},
|
||||
theme::Theme,
|
||||
widget::{button, divider},
|
||||
Element,
|
||||
};
|
||||
|
|
@ -218,9 +218,11 @@ impl cosmic::Application for Window {
|
|||
.on_press(Message::TogglePopup)
|
||||
.style(Button::Text)
|
||||
.into(),
|
||||
PanelAnchor::Top | PanelAnchor::Bottom => button(Button::Text)
|
||||
.custom(vec![row![
|
||||
icon(ID, self.core.applet_helper.suggested_size().0,).style(Svg::Symbolic),
|
||||
PanelAnchor::Top | PanelAnchor::Bottom => button(
|
||||
row![
|
||||
icon::from_name(ID)
|
||||
.size(self.core.applet_helper.suggested_size().0)
|
||||
.symbolic(true),
|
||||
text(match self.graphics_mode.map(|g| g.inner()) {
|
||||
Some(Graphics::Integrated) => fl!("integrated"),
|
||||
Some(Graphics::Nvidia) => fl!("nvidia"),
|
||||
|
|
@ -232,9 +234,9 @@ impl cosmic::Application for Window {
|
|||
]
|
||||
.spacing(8)
|
||||
.padding([0, self.core.applet_helper.suggested_size().0 / 2])
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
.style(Button::Text)
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(Button::Standard)
|
||||
.on_press(Message::TogglePopup)
|
||||
.padding(8)
|
||||
.width(Length::Shrink)
|
||||
|
|
@ -244,144 +246,109 @@ impl cosmic::Application for Window {
|
|||
}
|
||||
|
||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||
let symbolic = matches!(
|
||||
self.graphics_mode,
|
||||
Some(GraphicsMode::CurrentGraphicsMode(Graphics::Integrated))
|
||||
| Some(GraphicsMode::AppliedGraphicsMode(Graphics::Integrated))
|
||||
| Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Integrated,
|
||||
..
|
||||
})
|
||||
);
|
||||
let content_list = vec![
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
button(
|
||||
row![
|
||||
column![
|
||||
text(format!("{} {}", fl!("integrated"), fl!("graphics"))).size(14),
|
||||
text(fl!("integrated-desc")).size(12)
|
||||
]
|
||||
.width(Length::Fill),
|
||||
icon(
|
||||
match self.graphics_mode {
|
||||
icon::from_name(match self.graphics_mode {
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Integrated,
|
||||
..
|
||||
}) => "process-working-symbolic",
|
||||
_ => "emblem-ok-symbolic",
|
||||
},
|
||||
12
|
||||
)
|
||||
})
|
||||
.size(12)
|
||||
.style(match self.graphics_mode {
|
||||
Some(GraphicsMode::CurrentGraphicsMode(Graphics::Integrated)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::AppliedGraphicsMode(Graphics::Integrated)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Integrated,
|
||||
..
|
||||
}) => Svg::Symbolic,
|
||||
_ => Svg::Default,
|
||||
},),
|
||||
.symbolic(symbolic)
|
||||
.prefer_svg(!symbolic)
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Integrated))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
column![text(format!("{} {}", fl!("nvidia"), fl!("graphics"))).size(14),]
|
||||
button(
|
||||
row![
|
||||
column![text(format!("{} {}", fl!("nvidia"), fl!("graphics"))).size(14)]
|
||||
.width(Length::Fill),
|
||||
icon(
|
||||
match self.graphics_mode {
|
||||
icon::from_name(match self.graphics_mode {
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Nvidia,
|
||||
..
|
||||
}) => "process-working-symbolic",
|
||||
_ => "emblem-ok-symbolic",
|
||||
},
|
||||
12
|
||||
)
|
||||
},)
|
||||
.size(12)
|
||||
.style(match self.graphics_mode {
|
||||
Some(GraphicsMode::CurrentGraphicsMode(Graphics::Nvidia)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::AppliedGraphicsMode(Graphics::Nvidia)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Nvidia,
|
||||
..
|
||||
}) => Svg::Symbolic,
|
||||
_ => Svg::Default,
|
||||
}),
|
||||
.symbolic(symbolic)
|
||||
.prefer_svg(!symbolic),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Nvidia))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
button(
|
||||
row![
|
||||
column![
|
||||
text(format!("{} {}", fl!("hybrid"), fl!("graphics"))).size(14),
|
||||
text(fl!("hybrid-desc")).size(12)
|
||||
]
|
||||
.width(Length::Fill),
|
||||
icon(
|
||||
match self.graphics_mode {
|
||||
icon::from_name(match self.graphics_mode {
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Hybrid,
|
||||
..
|
||||
}) => "process-working-symbolic",
|
||||
_ => "emblem-ok-symbolic",
|
||||
},
|
||||
12
|
||||
)
|
||||
},)
|
||||
.size(12)
|
||||
.style(match self.graphics_mode {
|
||||
Some(GraphicsMode::CurrentGraphicsMode(Graphics::Hybrid)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::AppliedGraphicsMode(Graphics::Hybrid)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Hybrid,
|
||||
..
|
||||
}) => Svg::Symbolic,
|
||||
_ => Svg::Default,
|
||||
})
|
||||
.symbolic(symbolic)
|
||||
.prefer_svg(!symbolic),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Hybrid))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
button(applet_button_theme())
|
||||
.custom(vec![row![
|
||||
button(
|
||||
row![
|
||||
column![
|
||||
text(format!("{} {}", fl!("compute"), fl!("graphics"))).size(14),
|
||||
text(fl!("compute-desc")).size(12)
|
||||
]
|
||||
.width(Length::Fill),
|
||||
icon(
|
||||
match self.graphics_mode {
|
||||
icon::from_name(match self.graphics_mode {
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Compute,
|
||||
..
|
||||
}) => "process-working-symbolic",
|
||||
_ => "emblem-ok-symbolic",
|
||||
},
|
||||
12
|
||||
)
|
||||
},)
|
||||
.size(12)
|
||||
.style(match self.graphics_mode {
|
||||
Some(GraphicsMode::CurrentGraphicsMode(Graphics::Compute)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::AppliedGraphicsMode(Graphics::Compute)) =>
|
||||
Svg::SymbolicActive,
|
||||
Some(GraphicsMode::SelectedGraphicsMode {
|
||||
new: Graphics::Compute,
|
||||
..
|
||||
}) => Svg::Symbolic,
|
||||
_ => Svg::Default,
|
||||
}),
|
||||
.symbolic(symbolic)
|
||||
.prefer_svg(!symbolic)
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Compute))
|
||||
.width(Length::Fill)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use cosmic::app::Command;
|
||||
use cosmic::iced_style;
|
||||
use cosmic::iced_widget::Row;
|
||||
use cosmic::widget::button::StyleSheet;
|
||||
use cosmic::{
|
||||
iced::{
|
||||
wayland::popup::{destroy_popup, get_popup},
|
||||
|
|
@ -12,8 +12,8 @@ use cosmic::{
|
|||
layout::Limits,
|
||||
window,
|
||||
},
|
||||
iced_style::{application, button::StyleSheet},
|
||||
theme::{Button, Svg},
|
||||
iced_style::application,
|
||||
theme::Button,
|
||||
widget::{button, divider, icon},
|
||||
Element, Theme,
|
||||
};
|
||||
|
|
@ -406,13 +406,21 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
|
||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||
let button_style = || Button::Custom {
|
||||
active: Box::new(|t| iced_style::button::Appearance {
|
||||
active: Box::new(|active, t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.active(&Button::Text)
|
||||
..t.active(active, &Button::Standard)
|
||||
}),
|
||||
hover: Box::new(|t| iced_style::button::Appearance {
|
||||
disabled: Box::new(|t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.hovered(&Button::Text)
|
||||
..t.disabled(&Button::Text)
|
||||
}),
|
||||
hovered: Box::new(|hovered, t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.hovered(hovered, &Button::Text)
|
||||
}),
|
||||
pressed: Box::new(|pressed, t| button::Appearance {
|
||||
border_radius: 0.0.into(),
|
||||
..t.pressed(pressed, &Button::Text)
|
||||
}),
|
||||
};
|
||||
let mut vpn_ethernet_col = column![];
|
||||
|
|
@ -473,7 +481,10 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
);
|
||||
}
|
||||
let mut btn_content = vec![
|
||||
icon(wifi_icon(*strength), 24).style(Svg::Symbolic).into(),
|
||||
icon::from_name(wifi_icon(*strength))
|
||||
.size(24)
|
||||
.symbolic(true)
|
||||
.into(),
|
||||
column![text(name).size(14), Column::with_children(ipv4)]
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
|
|
@ -481,8 +492,9 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
match state {
|
||||
ActiveConnectionState::Activating | ActiveConnectionState::Deactivating => {
|
||||
btn_content.push(
|
||||
icon("process-working-symbolic", 24)
|
||||
.style(Svg::Symbolic)
|
||||
icon::from_name("process-working-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
|
@ -496,11 +508,12 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
_ => {}
|
||||
};
|
||||
known_wifi = known_wifi.push(
|
||||
column![button(Button::Secondary)
|
||||
.custom(vec![Row::with_children(btn_content)
|
||||
column![button(
|
||||
Row::with_children(btn_content)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(8)
|
||||
.into()])
|
||||
)
|
||||
.style(Button::Standard)
|
||||
.padding([8, 24])
|
||||
.style(button_style())
|
||||
.on_press(Message::Disconnect(name.clone()))]
|
||||
|
|
@ -547,7 +560,9 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
if self.nm_state.airplane_mode {
|
||||
content = content.push(
|
||||
column!(
|
||||
icon("airplane-mode-symbolic", 48).style(Svg::Symbolic),
|
||||
icon::from_name("airplane-mode-symbolic")
|
||||
.size(48)
|
||||
.symbolic(true),
|
||||
text(fl!("airplane-mode-on")).size(14),
|
||||
text(fl!("turn-off-airplane-mode")).size(12)
|
||||
)
|
||||
|
|
@ -562,37 +577,42 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
let ssid = text(&known.ssid).size(14).width(Length::Fill);
|
||||
if known.working {
|
||||
btn_content.push(
|
||||
icon("network-wireless-acquiring-symbolic", 24)
|
||||
.style(Svg::Symbolic)
|
||||
icon::from_name("network-wireless-acquiring-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true)
|
||||
.into(),
|
||||
);
|
||||
btn_content.push(ssid.into());
|
||||
btn_content.push(
|
||||
icon("process-working-symbolic", 24)
|
||||
.style(Svg::Symbolic)
|
||||
icon::from_name("process-working-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true)
|
||||
.into(),
|
||||
);
|
||||
} else if matches!(known.state, DeviceState::Unavailable) {
|
||||
btn_content.push(
|
||||
icon("network-wireless-disconnected-symbolic", 24)
|
||||
.style(Svg::Symbolic)
|
||||
icon::from_name("network-wireless-disconnected-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true)
|
||||
.into(),
|
||||
);
|
||||
btn_content.push(ssid.into());
|
||||
} else {
|
||||
btn_content.push(
|
||||
icon(wifi_icon(known.strength), 24)
|
||||
.style(Svg::Symbolic)
|
||||
icon::from_name(wifi_icon(known.strength))
|
||||
.size(24)
|
||||
.symbolic(true)
|
||||
.into(),
|
||||
);
|
||||
btn_content.push(ssid.into());
|
||||
}
|
||||
|
||||
let mut btn = button(Button::Secondary)
|
||||
.custom(vec![Row::with_children(btn_content)
|
||||
let mut btn = button(
|
||||
Row::with_children(btn_content)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(8)
|
||||
.into()])
|
||||
.spacing(8),
|
||||
)
|
||||
.style(Button::Suggested)
|
||||
.padding([8, 24])
|
||||
.width(Length::Fill)
|
||||
.style(button_style());
|
||||
|
|
@ -615,24 +635,19 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
} else {
|
||||
"go-next-symbolic"
|
||||
};
|
||||
let available_connections_btn = button(Button::Secondary)
|
||||
.custom(
|
||||
vec![
|
||||
let available_connections_btn = button(row![
|
||||
text(fl!("visible-wireless-networks"))
|
||||
.size(14)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fixed(24.0))
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.into(),
|
||||
container(icon(dropdown_icon, 14).style(Svg::Symbolic))
|
||||
.vertical_alignment(Vertical::Center),
|
||||
container(icon::from_name(dropdown_icon).size(14).symbolic(true))
|
||||
.align_x(Horizontal::Center)
|
||||
.align_y(Vertical::Center)
|
||||
.width(Length::Fixed(24.0))
|
||||
.height(Length::Fixed(24.0))
|
||||
.into(),
|
||||
]
|
||||
.into(),
|
||||
)
|
||||
.height(Length::Fixed(24.0)),
|
||||
])
|
||||
.style(Button::Text)
|
||||
.padding([8, 24])
|
||||
.style(button_style())
|
||||
.on_press(Message::ToggleVisibleNetworks);
|
||||
|
|
@ -646,7 +661,9 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
password,
|
||||
} => {
|
||||
let id = row![
|
||||
icon("network-wireless-acquiring-symbolic", 24).style(Svg::Symbolic),
|
||||
icon::from_name("network-wireless-acquiring-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
text(&access_point.ssid).size(14),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
|
|
@ -663,15 +680,11 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
.password(),
|
||||
container(text(fl!("router-wps-button"))).padding(8),
|
||||
row![
|
||||
button(Button::Secondary)
|
||||
.custom(vec![container(text(fl!("cancel")))
|
||||
.padding([0, 24])
|
||||
.into()])
|
||||
button(container(text(fl!("cancel"))).padding([0, 24]))
|
||||
.style(Button::Suggested)
|
||||
.on_press(Message::CancelNewConnection),
|
||||
button(Button::Secondary)
|
||||
.custom(vec![container(text(fl!("connect")))
|
||||
.padding([0, 24])
|
||||
.into()])
|
||||
button(container(text(fl!("connect"))).padding([0, 24]))
|
||||
.style(Button::Suggested)
|
||||
.on_press(Message::SubmitPassword)
|
||||
]
|
||||
.spacing(24)
|
||||
|
|
@ -683,7 +696,9 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
}
|
||||
NewConnectionState::Waiting(access_point) => {
|
||||
let id = row![
|
||||
icon("network-wireless-acquiring-symbolic", 24).style(Svg::Symbolic),
|
||||
icon::from_name("network-wireless-acquiring-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
text(&access_point.ssid).size(14),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
|
|
@ -691,7 +706,9 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
.spacing(12);
|
||||
let connecting = row![
|
||||
id,
|
||||
icon("process-working-symbolic", 24).style(Svg::Symbolic),
|
||||
icon::from_name("process-working-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
]
|
||||
.spacing(8)
|
||||
.padding([0, 24]);
|
||||
|
|
@ -699,7 +716,9 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
}
|
||||
NewConnectionState::Failure(access_point) => {
|
||||
let id = row![
|
||||
icon("network-wireless-error-symbolic", 24).style(Svg::Symbolic),
|
||||
icon::from_name("network-wireless-error-symbolic")
|
||||
.size(24)
|
||||
.symbolic(true),
|
||||
text(&access_point.ssid).size(14),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
|
|
@ -711,13 +730,11 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
text(fl!("unable-to-connect")),
|
||||
text(fl!("check-wifi-connection")),
|
||||
row![
|
||||
button(Button::Secondary)
|
||||
.custom(vec![container(text("Cancel")).padding([0, 24]).into()])
|
||||
button(container(text("Cancel")).padding([0, 24]))
|
||||
.style(Button::Suggested)
|
||||
.on_press(Message::CancelNewConnection),
|
||||
button(Button::Secondary)
|
||||
.custom(vec![container(text("Connect"))
|
||||
.padding([0, 24])
|
||||
.into()])
|
||||
button(container(text("Connect")).padding([0, 24]))
|
||||
.style(Button::Suggested)
|
||||
.on_press(Message::SelectWirelessAccessPoint(
|
||||
access_point.clone()
|
||||
))
|
||||
|
|
@ -741,17 +758,20 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
{
|
||||
continue;
|
||||
}
|
||||
let button = button(button_style())
|
||||
.custom(vec![row![
|
||||
icon(wifi_icon(ap.strength), 16).style(Svg::Symbolic),
|
||||
let button = button(
|
||||
row![
|
||||
icon::from_name(wifi_icon(ap.strength))
|
||||
.size(16)
|
||||
.symbolic(true),
|
||||
text(&ap.ssid)
|
||||
.size(14)
|
||||
.height(Length::Fixed(24.0))
|
||||
.vertical_alignment(Vertical::Center)
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(12)
|
||||
.into()])
|
||||
.spacing(12),
|
||||
)
|
||||
.style(button_style())
|
||||
.on_press(Message::SelectWirelessAccessPoint(ap.clone()))
|
||||
.width(Length::Fill)
|
||||
.padding([8, 24]);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ libcosmic.workspace = true
|
|||
cosmic-time.workspace = true
|
||||
nix = "0.26"
|
||||
tokio = { version = "1.24.1", features = ["sync", "rt", "tracing", "macros", "net", "io-util", "io-std"] }
|
||||
cosmic-notifications-util = { git = "https://github.com/pop-os/cosmic-notifications" }
|
||||
cosmic-notifications-config = { git = "https://github.com/pop-os/cosmic-notifications" }
|
||||
cosmic-notifications-util = { git = "https://github.com/edfloreshz/cosmic-notifications" }
|
||||
cosmic-notifications-config = { git = "https://github.com/edfloreshz/cosmic-notifications" }
|
||||
# cosmic-notifications-util = { path = "../../cosmic-notifications-daemon/cosmic-notifications-util" }
|
||||
# cosmic-notifications-config = { path = "../../cosmic-notifications-daemon/cosmic-notifications-config" }
|
||||
tracing = "0.1"
|
||||
|
|
|
|||
|
|
@ -6,18 +6,15 @@ use cosmic::cosmic_config::{config_subscription, Config, CosmicConfigEntry};
|
|||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||
use cosmic::iced::Limits;
|
||||
use cosmic::iced::{
|
||||
widget::{button, column, row, text, Row},
|
||||
widget::{column, row, text, Row},
|
||||
window, Alignment, Length, Subscription,
|
||||
};
|
||||
use cosmic::iced_core::alignment::Horizontal;
|
||||
use cosmic::iced_core::image;
|
||||
use cosmic::iced_widget::image::Handle;
|
||||
|
||||
use cosmic::iced_style::application;
|
||||
|
||||
use cosmic::iced_widget::{horizontal_rule, scrollable, Column};
|
||||
use cosmic::theme::Svg;
|
||||
use cosmic::widget::{container, icon};
|
||||
use cosmic::widget::{button, container, icon};
|
||||
use cosmic::Renderer;
|
||||
use cosmic::{Element, Theme};
|
||||
use cosmic_notifications_config::NotificationsConfig;
|
||||
|
|
@ -348,8 +345,9 @@ impl cosmic::Application for Notifications {
|
|||
continue;
|
||||
}
|
||||
let name = c.1[0].app_name.clone();
|
||||
let notif_elems: Vec<_> =
|
||||
c.1.iter()
|
||||
let notif_elems: Vec<_> = c
|
||||
.1
|
||||
.iter()
|
||||
.rev()
|
||||
.map(|n| {
|
||||
let app_name = text(if n.app_name.len() > 24 {
|
||||
|
|
@ -365,8 +363,11 @@ impl cosmic::Application for Notifications {
|
|||
|
||||
let duration_since = text(duration_ago_msg(n)).size(12);
|
||||
|
||||
let close_notif =
|
||||
button(icon("window-close-symbolic", 16).style(Svg::Symbolic))
|
||||
let close_notif = button(
|
||||
icon::from_name("window-close-symbolic")
|
||||
.size(16)
|
||||
.symbolic(true),
|
||||
)
|
||||
.on_press(Message::Dismissed(n.id))
|
||||
.style(cosmic::theme::Button::Text);
|
||||
Element::from(
|
||||
|
|
@ -374,7 +375,7 @@ impl cosmic::Application for Notifications {
|
|||
match n.image() {
|
||||
Some(cosmic_notifications_util::Image::File(path)) => {
|
||||
row![
|
||||
icon(path.as_path(), 16),
|
||||
icon::from_path(PathBuf::from(path)).icon().size(16),
|
||||
app_name,
|
||||
duration_since,
|
||||
close_notif
|
||||
|
|
@ -384,7 +385,7 @@ impl cosmic::Application for Notifications {
|
|||
}
|
||||
Some(cosmic_notifications_util::Image::Name(name)) => {
|
||||
row![
|
||||
icon(name.as_str(), 16),
|
||||
icon::from_name(name.as_str()).size(16),
|
||||
app_name,
|
||||
duration_since,
|
||||
close_notif
|
||||
|
|
@ -397,13 +398,10 @@ impl cosmic::Application for Notifications {
|
|||
height,
|
||||
data,
|
||||
}) => {
|
||||
let handle = image::Handle::from_pixels(
|
||||
*width,
|
||||
*height,
|
||||
data.clone(),
|
||||
);
|
||||
row![
|
||||
icon(handle, 16),
|
||||
icon::from_raster_pixels(*width, *height, data.clone())
|
||||
.icon()
|
||||
.size(16),
|
||||
app_name,
|
||||
duration_since,
|
||||
close_notif
|
||||
|
|
@ -432,28 +430,28 @@ impl cosmic::Application for Notifications {
|
|||
info!("app_icon: {:?}", &n.app_icon);
|
||||
if n.app_icon.is_empty() {
|
||||
match n.image().cloned() {
|
||||
Some(Image::File(p)) => Some(cosmic::widget::IconSource::Path(
|
||||
Cow::Owned(PathBuf::from(p)),
|
||||
)),
|
||||
Some(Image::File(p)) => {
|
||||
Some(cosmic::widget::icon::from_path(PathBuf::from(p)))
|
||||
}
|
||||
Some(Image::Name(name)) => {
|
||||
Some(cosmic::widget::IconSource::Name(Cow::Owned(name)))
|
||||
Some(cosmic::widget::icon::from_name(name).handle())
|
||||
}
|
||||
Some(Image::Data {
|
||||
width,
|
||||
height,
|
||||
data,
|
||||
}) => Some(cosmic::widget::IconSource::Handle(icon::Handle::Image(
|
||||
Handle::from_pixels(width, height, data),
|
||||
))),
|
||||
}) => Some(cosmic::widget::icon::from_raster_pixels(
|
||||
width, height, data,
|
||||
)),
|
||||
None => None,
|
||||
}
|
||||
} else if let Some(path) = url::Url::parse(&n.app_icon)
|
||||
.ok()
|
||||
.and_then(|u| u.to_file_path().ok())
|
||||
{
|
||||
Some(cosmic::widget::IconSource::Path(Cow::Owned(path)))
|
||||
Some(cosmic::widget::icon::from_path(path))
|
||||
} else {
|
||||
Some(cosmic::widget::IconSource::Name(Cow::Borrowed(&n.app_icon)))
|
||||
Some(cosmic::widget::icon::from_name(n.app_icon.clone()).handle())
|
||||
}
|
||||
});
|
||||
let card_list = anim!(
|
||||
|
|
@ -499,7 +497,7 @@ impl cosmic::Application for Notifications {
|
|||
}
|
||||
|
||||
// todo put into libcosmic doing so will fix the row_button's border radius
|
||||
fn row_button(content: Vec<Element<Message>>) -> cosmic::iced::widget::Button<Message, Renderer> {
|
||||
fn row_button(content: Vec<Element<Message>>) -> cosmic::widget::Button<Message, Renderer> {
|
||||
button(
|
||||
Row::with_children(content)
|
||||
.spacing(4)
|
||||
|
|
@ -512,7 +510,7 @@ fn row_button(content: Vec<Element<Message>>) -> cosmic::iced::widget::Button<Me
|
|||
}
|
||||
|
||||
fn text_icon(name: &str, size: u16) -> cosmic::widget::Icon {
|
||||
icon(name, size).style(Svg::Symbolic)
|
||||
icon::from_name(name).size(size).symbolic(true).icon()
|
||||
}
|
||||
|
||||
fn duration_ago_msg(notification: &Notification) -> String {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use cosmic::iced::{
|
|||
window, Alignment, Length, Subscription,
|
||||
};
|
||||
use cosmic::iced_style::application;
|
||||
use cosmic::theme::{self, Svg};
|
||||
use cosmic::theme;
|
||||
use cosmic::{app::Command, Element, Theme};
|
||||
|
||||
use logind_zbus::manager::ManagerProxy;
|
||||
|
|
@ -42,6 +42,8 @@ use crate::cosmic_session::CosmicSessionProxy;
|
|||
use crate::session_manager::SessionManagerProxy;
|
||||
|
||||
pub fn main() -> cosmic::iced::Result {
|
||||
localize::localize();
|
||||
|
||||
cosmic::app::applet::run::<Power>(false, ())
|
||||
}
|
||||
|
||||
|
|
@ -76,11 +78,19 @@ enum Message {
|
|||
}
|
||||
|
||||
impl cosmic::Application for Power {
|
||||
type Message = Message;
|
||||
type Executor = cosmic::SingleThreadExecutor;
|
||||
type Flags = ();
|
||||
type Message = Message;
|
||||
const APP_ID: &'static str = "com.system76.CosmicAppletPower";
|
||||
|
||||
fn core(&self) -> &cosmic::app::Core {
|
||||
&self.core
|
||||
}
|
||||
|
||||
fn core_mut(&mut self) -> &mut cosmic::app::Core {
|
||||
&mut self.core
|
||||
}
|
||||
|
||||
fn init(core: cosmic::app::Core, _flags: ()) -> (Power, Command<Message>) {
|
||||
(
|
||||
Power {
|
||||
|
|
@ -92,16 +102,8 @@ impl cosmic::Application for Power {
|
|||
)
|
||||
}
|
||||
|
||||
fn core(&self) -> &cosmic::app::Core {
|
||||
&self.core
|
||||
}
|
||||
|
||||
fn core_mut(&mut self) -> &mut cosmic::app::Core {
|
||||
&mut self.core
|
||||
}
|
||||
|
||||
fn style(&self) -> Option<<Theme as application::StyleSheet>::Style> {
|
||||
Some(cosmic::app::applet::style())
|
||||
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
|
||||
Some(Message::Closed(id))
|
||||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Message> {
|
||||
|
|
@ -294,11 +296,13 @@ impl cosmic::Application for Power {
|
|||
))
|
||||
.size(16),
|
||||
row![
|
||||
button(theme::Button::Primary)
|
||||
.custom(vec![text(fl!("confirm")).size(14).into()])
|
||||
button(text(fl!("confirm")).size(14))
|
||||
.padding(2)
|
||||
.style(theme::Button::Suggested)
|
||||
.on_press(Message::Confirm),
|
||||
button(theme::Button::Primary)
|
||||
.custom(vec![text(fl!("cancel")).size(14).into()])
|
||||
button(text(fl!("cancel")).size(14))
|
||||
.padding(2)
|
||||
.style(theme::Button::Standard)
|
||||
.on_press(Message::Cancel),
|
||||
]
|
||||
.spacing(24)
|
||||
|
|
@ -310,7 +314,8 @@ impl cosmic::Application for Power {
|
|||
container(
|
||||
container(content)
|
||||
.style(cosmic::theme::Container::custom(|theme| {
|
||||
cosmic::iced_style::container::Appearance {
|
||||
container::Appearance {
|
||||
icon_color: Some(theme.cosmic().background.on.into()),
|
||||
text_color: Some(theme.cosmic().background.on.into()),
|
||||
background: Some(
|
||||
Color::from(theme.cosmic().background.base).into(),
|
||||
|
|
@ -338,36 +343,37 @@ impl cosmic::Application for Power {
|
|||
}
|
||||
}
|
||||
|
||||
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
|
||||
Some(Message::Closed(id))
|
||||
fn style(&self) -> Option<<Theme as application::StyleSheet>::Style> {
|
||||
Some(cosmic::app::applet::style())
|
||||
}
|
||||
}
|
||||
|
||||
// ### UI Helplers
|
||||
|
||||
fn row_button(content: Vec<Element<Message>>) -> widget::Button<Message, Renderer> {
|
||||
button(applet_button_theme())
|
||||
.custom(vec![Row::with_children(content)
|
||||
fn row_button(content: Vec<Element<Message>>) -> cosmic::widget::Button<Message, Renderer> {
|
||||
button(
|
||||
Row::with_children(content)
|
||||
.spacing(4)
|
||||
.align_items(Alignment::Center)
|
||||
.into()])
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.width(Length::Fill)
|
||||
.padding([8, 24])
|
||||
}
|
||||
|
||||
fn power_buttons<'a>(name: &'a str, msg: String) -> widget::Button<'a, Message, Renderer> {
|
||||
widget::button(
|
||||
fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message, Renderer> {
|
||||
cosmic::widget::button(
|
||||
column![text_icon(name, 40), text(msg).size(14)]
|
||||
.spacing(4)
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fixed(76.0))
|
||||
.style(theme::Button::Text)
|
||||
.style(theme::Button::Standard)
|
||||
}
|
||||
|
||||
fn text_icon(name: &str, size: u16) -> cosmic::widget::Icon {
|
||||
icon(name, size).style(Svg::Symbolic)
|
||||
icon::from_name(name).size(size).symbolic(true).icon()
|
||||
}
|
||||
|
||||
// ### System helpers
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use cosmic::{iced, theme};
|
||||
use cosmic::app::applet::applet_button_theme;
|
||||
use cosmic::iced;
|
||||
|
||||
use crate::subscriptions::status_notifier_item::{Layout, StatusNotifierItem};
|
||||
|
||||
|
|
@ -107,27 +108,28 @@ fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
|
|||
|
||||
let mut children: Vec<cosmic::Element<_>> = vec![text.into()];
|
||||
if is_submenu {
|
||||
let icon = cosmic::widget::icon(
|
||||
if is_expanded {
|
||||
let icon = cosmic::widget::icon::from_name(if is_expanded {
|
||||
"go-down-symbolic"
|
||||
} else {
|
||||
"go-next-symbolic"
|
||||
},
|
||||
14,
|
||||
)
|
||||
.style(theme::Svg::Symbolic);
|
||||
})
|
||||
.size(14)
|
||||
.symbolic(true);
|
||||
children.push(icon.into());
|
||||
}
|
||||
if let Some(icon_data) = i.icon_data() {
|
||||
let handle = iced::widget::image::Handle::from_memory(icon_data.to_vec());
|
||||
children.insert(0, iced::widget::Image::new(handle).into());
|
||||
} else if let Some(icon_name) = i.icon_name() {
|
||||
let icon = cosmic::widget::icon(icon_name, 14).style(theme::Svg::Symbolic);
|
||||
let icon = cosmic::widget::icon::from_name(icon_name)
|
||||
.size(14)
|
||||
.symbolic(true);
|
||||
children.insert(0, icon.into());
|
||||
}
|
||||
if i.toggle_state() == Some(1) {
|
||||
let icon = cosmic::widget::icon("emblem-ok-symbolic", 14)
|
||||
.style(theme::Svg::Symbolic);
|
||||
let icon = cosmic::widget::icon::from_name("emblem-ok-symbolic")
|
||||
.size(14)
|
||||
.symbolic(true);
|
||||
children.push(icon.into());
|
||||
}
|
||||
let button = row_button(children).on_press(Msg::Click(i.id(), is_submenu));
|
||||
|
|
@ -158,13 +160,14 @@ fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
|
|||
.into()
|
||||
}
|
||||
|
||||
fn row_button(content: Vec<cosmic::Element<Msg>>) -> iced::widget::Button<Msg, cosmic::Renderer> {
|
||||
cosmic::widget::button(cosmic::app::applet::applet_button_theme())
|
||||
.custom(vec![iced::widget::Row::with_children(content)
|
||||
fn row_button(content: Vec<cosmic::Element<Msg>>) -> cosmic::widget::Button<Msg, cosmic::Renderer> {
|
||||
cosmic::widget::button(
|
||||
iced::widget::Row::with_children(content)
|
||||
.spacing(8)
|
||||
.align_items(iced::Alignment::Center)
|
||||
.width(iced::Length::Fill)
|
||||
.into()])
|
||||
.width(iced::Length::Fill),
|
||||
)
|
||||
.style(applet_button_theme())
|
||||
.width(iced::Length::Fill)
|
||||
.padding([8, 24])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
libcosmic.workspace = true
|
||||
cosmic-time.workspace = true
|
||||
once_cell = "1"
|
||||
i18n-embed = { version = "0.14.0", features = ["fluent-system", "desktop-requester"] }
|
||||
i18n-embed-fl = "0.7.0"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,163 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07, custom)"
|
||||
sodipodi:docname="pop-shell-auto-off-symbolic.svg"
|
||||
width="16.031464"
|
||||
version="1.1"
|
||||
style="enable-background:new"
|
||||
id="svg7384"
|
||||
height="16">
|
||||
<sodipodi:namedview
|
||||
inkscape:current-layer="svg7384"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:window-y="23"
|
||||
inkscape:window-x="26"
|
||||
inkscape:cy="7.8736667"
|
||||
inkscape:cx="5.4863836"
|
||||
inkscape:zoom="47.743848"
|
||||
showgrid="true"
|
||||
id="namedview26"
|
||||
inkscape:window-height="1032"
|
||||
inkscape:window-width="1904"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0"
|
||||
guidetolerance="10"
|
||||
gridtolerance="10"
|
||||
objecttolerance="10"
|
||||
borderopacity="1"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff"
|
||||
inkscape:snap-intersection-paths="true"
|
||||
inkscape:snap-smooth-nodes="true"
|
||||
inkscape:document-rotation="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid834" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Pop Symbolic Icon Theme</dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title8473">Pop Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient8297">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop8295" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient6882">
|
||||
<stop
|
||||
style="stop-color:#555555;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6884" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient5606">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5608" />
|
||||
</linearGradient>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter7554">
|
||||
<feBlend
|
||||
mode="darken"
|
||||
in2="BackgroundImage"
|
||||
id="feBlend7556" />
|
||||
</filter>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-1124.0002,555.55128)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555.55128)"
|
||||
style="display:inline;filter:url(#filter7554)"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-883,-61.448718)"
|
||||
style="display:inline"
|
||||
id="layer1" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555.55128)"
|
||||
style="display:inline"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555.55128)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555.55128)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-883,88.551282)"
|
||||
style="display:inline"
|
||||
id="layer2" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555.55128)"
|
||||
style="display:inline"
|
||||
id="layer12" />
|
||||
<path
|
||||
style="fill:#4c5263;fill-opacity:0.988327;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 11,9.5512818 v 1.1992192 c 0,0.979903 -0.820878,1.800781 -1.800781,1.800781 H 4 v 1.199219 c 0,0.4432 0.3575812,0.800781 0.8007812,0.800781 H 13.199219 C 13.642419,14.551282 14,14.193701 14,13.750501 V 9.5512818 Z"
|
||||
id="rect3162"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="csscsssscc" />
|
||||
<path
|
||||
style="fill:#4c5263;fill-opacity:0.988327;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 6.8007812,1.5512818 C 6.3575812,1.5512818 6,1.908863 6,2.352063 v 1.1992188 h 3.199219 c 0.979903,0 1.777249,0.8211611 1.800781,1.8007812 v 3.1992188 h 4.199219 C 15.642419,8.5512818 16,8.1937006 16,7.7505006 V 2.352063 c 0,-0.4432 -0.357581,-0.8007812 -0.800781,-0.8007812 z"
|
||||
id="rect3160"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sscsscsssss" />
|
||||
<rect
|
||||
height="7"
|
||||
id="rect3158"
|
||||
ry="0.80000001"
|
||||
style="fill:#4c5263;fill-opacity:0.988327;stroke:none;stroke-width:113.386;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
width="10"
|
||||
x="0"
|
||||
y="4.5512819" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
|
|
@ -0,0 +1,161 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07, custom)"
|
||||
sodipodi:docname="pop-shell-auto-on-symbolic.svg"
|
||||
width="16.031464"
|
||||
version="1.1"
|
||||
style="enable-background:new"
|
||||
id="svg7384"
|
||||
height="16">
|
||||
<sodipodi:namedview
|
||||
inkscape:current-layer="svg7384"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-x="0"
|
||||
inkscape:cy="8.1513747"
|
||||
inkscape:cx="5.7085514"
|
||||
inkscape:zoom="51.17"
|
||||
showgrid="false"
|
||||
id="namedview26"
|
||||
inkscape:window-height="1048"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0"
|
||||
guidetolerance="10"
|
||||
gridtolerance="10"
|
||||
objecttolerance="10"
|
||||
borderopacity="1"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff"
|
||||
inkscape:document-rotation="0" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Pop Symbolic Icon Theme</dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title8473">Pop Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient8297">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop8295" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient6882">
|
||||
<stop
|
||||
style="stop-color:#555555;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6884" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient5606">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5608" />
|
||||
</linearGradient>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter7554">
|
||||
<feBlend
|
||||
mode="darken"
|
||||
in2="BackgroundImage"
|
||||
id="feBlend7556" />
|
||||
</filter>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-1124.0002,555)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555)"
|
||||
style="display:inline;filter:url(#filter7554)"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-883,-62)"
|
||||
style="display:inline"
|
||||
id="layer1" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555)"
|
||||
style="display:inline"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-883,88)"
|
||||
style="display:inline"
|
||||
id="layer2" />
|
||||
<rect
|
||||
height="8.9525318"
|
||||
id="rect3158"
|
||||
ry="0.65109324"
|
||||
style="fill:#4c5263;fill-opacity:0.988327;stroke:none;stroke-width:102.291;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
width="7"
|
||||
x="0"
|
||||
y="3.9999995" />
|
||||
<rect
|
||||
height="4.0693326"
|
||||
id="rect3160"
|
||||
ry="0.65109324"
|
||||
style="fill:#4c5263;fill-opacity:0.988327;stroke:none;stroke-width:102.291;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
width="8"
|
||||
x="8"
|
||||
y="3.9999995" />
|
||||
<rect
|
||||
height="4.0693326"
|
||||
id="rect3162"
|
||||
ry="0.65109324"
|
||||
style="fill:#4c5263;fill-opacity:0.988327;stroke:none;stroke-width:102.291;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
width="8"
|
||||
x="8"
|
||||
y="8.8831997" />
|
||||
<g
|
||||
transform="translate(-1124.0002,555)"
|
||||
style="display:inline"
|
||||
id="layer12" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
|
|
@ -1,41 +0,0 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="applet-graphics-mode">
|
||||
<rect id="Rectangle 47" x="4" y="4" width="8" height="8" fill="#232323"/>
|
||||
<g id="Rectangle 48">
|
||||
<path d="M4 0.75C4 0.75 4 0 5 0C6 0 6 0.75 6 0.75V3H4V0.75Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 54">
|
||||
<path d="M0.75 6C0.75 6 0 6 0 5C0 4 0.75 4 0.75 4H3V6H0.75Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 57">
|
||||
<path d="M15.25 6C15.25 6 16 6 16 5C16 4 15.25 4 15.25 4H13V6H15.25Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 51">
|
||||
<path d="M4 15.25C4 15.25 4 16 5 16C6 16 6 15.25 6 15.25V13H4V15.25Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 49">
|
||||
<path d="M7 0.75C7 0.75 7 0 8 0C9 0 9 0.75 9 0.75V3H7V0.75Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 55">
|
||||
<path d="M0.75 9C0.75 9 0 9 0 8C0 7 0.75 7 0.75 7H3V9H0.75Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 58">
|
||||
<path d="M15.25 9C15.25 9 16 9 16 8C16 7 15.25 7 15.25 7H13V9H15.25Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 52">
|
||||
<path d="M7 15.25C7 15.25 7 16 8 16C9 16 9 15.25 9 15.25V13H7V15.25Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 50">
|
||||
<path d="M10 0.75C10 0.75 10 0 11 0C12 0 12 0.75 12 0.75V3H10V0.75Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 56">
|
||||
<path d="M0.75 12C0.75 12 0 12 0 11C0 10 0.75 10 0.75 10H3V12H0.75Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 59">
|
||||
<path d="M15.25 12C15.25 12 16 12 16 11C16 10 15.25 10 15.25 10H13V12H15.25Z" fill="#232323"/>
|
||||
</g>
|
||||
<g id="Rectangle 53">
|
||||
<path d="M10 15.25C10 15.25 10 16 11 16C12 16 12 15.25 12 15.25V13H10V15.25Z" fill="#232323"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
|
|
@ -1,27 +1,32 @@
|
|||
use crate::fl;
|
||||
use cosmic::app::Core;
|
||||
use cosmic::cosmic_theme::palette::rgb::Rgb;
|
||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||
use cosmic::iced::window::Id;
|
||||
use cosmic::iced::{Command, Limits};
|
||||
use cosmic::iced::{Command, Length, Limits, Subscription};
|
||||
use cosmic::iced_runtime::core::window;
|
||||
use cosmic::iced_style::application;
|
||||
use cosmic::theme::{Button, Svg};
|
||||
use cosmic::widget::{button, list_column, settings, spin_button, text, toggler};
|
||||
use cosmic::widget::{column, container, divider, spin_button, text};
|
||||
use cosmic::{Element, Theme};
|
||||
use cosmic_time::{anim, chain, id, Timeline};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::time::Instant;
|
||||
use cosmic::iced_widget::row;
|
||||
|
||||
const ID: &str = "com.system76.CosmicAppletTiling";
|
||||
const ON: &str = "com.system76.CosmicAppletTiling.On";
|
||||
const OFF: &str = "com.system76.CosmicAppletTiling.Off";
|
||||
|
||||
static TILE_WINDOWS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
|
||||
static SHOW_ACTIVE_HINTS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Window {
|
||||
core: Core,
|
||||
popup: Option<Id>,
|
||||
timeline: Timeline,
|
||||
id_ctr: u128,
|
||||
tile_windows: bool,
|
||||
show_window_titles: bool,
|
||||
show_active_hint: bool,
|
||||
active_border_radius: spin_button::Model<i32>,
|
||||
active_hint_color: Rgb,
|
||||
gaps: spin_button::Model<i32>,
|
||||
}
|
||||
|
||||
|
|
@ -29,11 +34,9 @@ pub struct Window {
|
|||
pub enum Message {
|
||||
TogglePopup,
|
||||
PopupClosed(Id),
|
||||
ToggleTileWindows(bool),
|
||||
ToggleShowWindowTitles(bool),
|
||||
ToggleShowActiveHint(bool),
|
||||
HandleActiveBorderRadius(spin_button::Message),
|
||||
SetActiveHintColor(Rgb),
|
||||
Frame(Instant),
|
||||
ToggleTileWindows(chain::Toggler, bool),
|
||||
ToggleShowActiveHint(chain::Toggler, bool),
|
||||
HandleGaps(spin_button::Message),
|
||||
}
|
||||
|
||||
|
|
@ -57,17 +60,24 @@ impl cosmic::Application for Window {
|
|||
) -> (Self, Command<cosmic::app::Message<Self::Message>>) {
|
||||
let window = Window {
|
||||
core,
|
||||
active_border_radius: spin_button::Model::default().max(99).min(0).step(1),
|
||||
gaps: spin_button::Model::default().max(99).min(0).step(1),
|
||||
..Default::default()
|
||||
};
|
||||
(window, Command::none())
|
||||
}
|
||||
|
||||
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
|
||||
fn on_close_requested(&self, id: Id) -> Option<Message> {
|
||||
Some(Message::PopupClosed(id))
|
||||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Self::Message> {
|
||||
let timeline = self
|
||||
.timeline
|
||||
.as_subscription()
|
||||
.map(|(_, now)| Message::Frame(now));
|
||||
Subscription::batch(vec![timeline])
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Self::Message) -> Command<cosmic::app::Message<Self::Message>> {
|
||||
match message {
|
||||
Message::TogglePopup => {
|
||||
|
|
@ -94,18 +104,15 @@ impl cosmic::Application for Window {
|
|||
self.popup = None;
|
||||
}
|
||||
}
|
||||
Message::ToggleTileWindows(toggled) => self.tile_windows = toggled,
|
||||
Message::ToggleShowWindowTitles(toggled) => self.show_window_titles = toggled,
|
||||
Message::ToggleShowActiveHint(toggled) => self.show_active_hint = toggled,
|
||||
Message::HandleActiveBorderRadius(msg) => match msg {
|
||||
spin_button::Message::Increment => self
|
||||
.active_border_radius
|
||||
.update(spin_button::Message::Increment),
|
||||
spin_button::Message::Decrement => self
|
||||
.active_border_radius
|
||||
.update(spin_button::Message::Decrement),
|
||||
},
|
||||
Message::SetActiveHintColor(_) => {}
|
||||
Message::Frame(now) => self.timeline.now(now),
|
||||
Message::ToggleTileWindows(chain, toggled) => {
|
||||
self.timeline.set_chain(chain).start();
|
||||
self.tile_windows = toggled
|
||||
}
|
||||
Message::ToggleShowActiveHint(chain, toggled) => {
|
||||
self.timeline.set_chain(chain).start();
|
||||
self.show_active_hint = toggled
|
||||
}
|
||||
Message::HandleGaps(msg) => match msg {
|
||||
spin_button::Message::Increment => {
|
||||
self.gaps.update(spin_button::Message::Increment)
|
||||
|
|
@ -121,64 +128,66 @@ impl cosmic::Application for Window {
|
|||
fn view(&self) -> Element<Self::Message> {
|
||||
self.core
|
||||
.applet_helper
|
||||
.icon_button(ID)
|
||||
.icon_button(OFF)
|
||||
.on_press(Message::TogglePopup)
|
||||
.style(Button::Text)
|
||||
.into()
|
||||
}
|
||||
|
||||
fn view_window(&self, _id: Id) -> Element<Self::Message> {
|
||||
let content_list = list_column()
|
||||
.add(settings::item(
|
||||
let content_list = cosmic::widget::column()
|
||||
.padding(20)
|
||||
.spacing(10)
|
||||
.push(
|
||||
container(
|
||||
anim!(
|
||||
TILE_WINDOWS,
|
||||
&self.timeline,
|
||||
fl!("tile-windows"),
|
||||
toggler(None, self.tile_windows, |value| {
|
||||
Message::ToggleTileWindows(value)
|
||||
}),
|
||||
))
|
||||
.add(settings::item(
|
||||
fl!("floating-window-exceptions"),
|
||||
button(Button::Card).icon(Svg::Symbolic, "arrow-right", 16),
|
||||
))
|
||||
.add(
|
||||
settings::view_section(fl!("shortcuts"))
|
||||
.add(settings::item(
|
||||
fl!("launcher"),
|
||||
text(format!("{} + /", fl!("super"))),
|
||||
))
|
||||
.add(settings::item(
|
||||
fl!("navigate-windows"),
|
||||
text(format!("{} + {}", fl!("super"), fl!("arrow-keys"))),
|
||||
))
|
||||
.add(settings::item(
|
||||
fl!("toggle-tiling"),
|
||||
text(format!("{} + Y", fl!("super"))),
|
||||
))
|
||||
.add(settings::item(fl!("view-all"), text(""))),
|
||||
self.tile_windows,
|
||||
|chain, enable| { Message::ToggleTileWindows(chain, enable) },
|
||||
)
|
||||
.add(settings::item(
|
||||
fl!("show-window-titles"),
|
||||
toggler(None, self.show_window_titles, |value| {
|
||||
Message::ToggleShowWindowTitles(value)
|
||||
}),
|
||||
.text_size(14)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.padding([0, 12]),
|
||||
)
|
||||
.push(divider::horizontal::light())
|
||||
.push(
|
||||
column()
|
||||
.push(row!(
|
||||
text(fl!("launcher")).size(14).width(Length::Fill),
|
||||
text(format!("{} + /", fl!("super"))).size(14),
|
||||
))
|
||||
.add(settings::item(
|
||||
.push(row!(
|
||||
text(fl!("navigate-windows")).size(14).width(Length::Fill),
|
||||
text(format!("{} + {}", fl!("super"), fl!("arrow-keys"))).size(14),
|
||||
))
|
||||
.push(row!(
|
||||
text(fl!("toggle-tiling")).size(14).width(Length::Fill),
|
||||
text(format!("{} + Y", fl!("super"))).size(14),
|
||||
))
|
||||
.spacing(10)
|
||||
.padding([0, 20, 0, 20]),
|
||||
)
|
||||
.push(divider::horizontal::light())
|
||||
.push(
|
||||
container(
|
||||
anim!(
|
||||
SHOW_ACTIVE_HINTS,
|
||||
&self.timeline,
|
||||
fl!("show-active-hint"),
|
||||
toggler(None, self.show_active_hint, |value| {
|
||||
Message::ToggleShowActiveHint(value)
|
||||
}),
|
||||
))
|
||||
.add(settings::item(
|
||||
fl!("active-border-radius"),
|
||||
spin_button(
|
||||
self.active_border_radius.value.to_string(),
|
||||
Message::HandleActiveBorderRadius,
|
||||
),
|
||||
))
|
||||
.add(settings::item(fl!("active-hint-color"), text("TODO")))
|
||||
.add(settings::item(
|
||||
fl!("gaps"),
|
||||
self.show_active_hint,
|
||||
|chain, enable| { Message::ToggleShowActiveHint(chain, enable) },
|
||||
)
|
||||
.text_size(14)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.padding([0, 12]),
|
||||
)
|
||||
.push(row!(
|
||||
text(fl!("gaps")).size(14).width(Length::Fill),
|
||||
spin_button(self.gaps.value.to_string(), Message::HandleGaps),
|
||||
));
|
||||
).padding([0, 10, 0, 10]));
|
||||
|
||||
self.core.applet_helper.popup_container(content_list).into()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,24 +179,20 @@ impl cosmic::Application for Time {
|
|||
self.core.applet_helper.anchor,
|
||||
PanelAnchor::Top | PanelAnchor::Bottom
|
||||
) {
|
||||
column![text(self.now.format("%b %-d %-I:%M %p").to_string()).size(14)]
|
||||
column![cosmic::widget::text(self.now.format("%b %-d %-I:%M %p").to_string()).size(14)]
|
||||
} else {
|
||||
let mut date_time_col = column![
|
||||
icon(
|
||||
"emoji-recent-symbolic",
|
||||
self.core.applet_helper.suggested_size().0
|
||||
)
|
||||
.style(theme::Svg::Symbolic),
|
||||
icon::from_name("emoji-recent-symbolic")
|
||||
.size(self.core.applet_helper.suggested_size().0)
|
||||
.symbolic(true),
|
||||
text(self.now.format("%I").to_string()).size(14),
|
||||
text(self.now.format("%M").to_string()).size(14),
|
||||
text(self.now.format("%p").to_string()).size(14),
|
||||
vertical_space(Length::Fixed(4.0)),
|
||||
// TODO better calendar icon?
|
||||
icon(
|
||||
"calendar-go-today-symbolic",
|
||||
self.core.applet_helper.suggested_size().0
|
||||
)
|
||||
.style(theme::Svg::Symbolic),
|
||||
icon::from_name("calendar-go-today-symbolic")
|
||||
.size(self.core.applet_helper.suggested_size().0)
|
||||
.symbolic(true),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(4);
|
||||
|
|
@ -207,7 +203,7 @@ impl cosmic::Application for Time {
|
|||
},
|
||||
)
|
||||
.on_press(Message::TogglePopup)
|
||||
.style(theme::Button::Text);
|
||||
.style(theme::iced::Button::Text);
|
||||
|
||||
if let Some(tracker) = self.rectangle_tracker.as_ref() {
|
||||
tracker.container(0, button).into()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ use cosmic::iced::mouse::{self, ScrollDelta};
|
|||
use cosmic::iced::widget::{column, container, row, text};
|
||||
use cosmic::iced::{subscription, widget::button, Event::Mouse, Length, Subscription};
|
||||
use cosmic::iced_style::application;
|
||||
use cosmic::theme::Button;
|
||||
use cosmic::{Element, Theme};
|
||||
|
||||
use cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1;
|
||||
|
|
@ -135,9 +134,13 @@ impl cosmic::Application for IcedWorkspacesApplet {
|
|||
.padding(0);
|
||||
Some(
|
||||
btn.style(match w.1 {
|
||||
Some(zcosmic_workspace_handle_v1::State::Active) => Button::Primary,
|
||||
Some(zcosmic_workspace_handle_v1::State::Urgent) => Button::Destructive,
|
||||
None => Button::Secondary,
|
||||
Some(zcosmic_workspace_handle_v1::State::Active) => {
|
||||
cosmic::theme::iced::Button::Primary
|
||||
}
|
||||
Some(zcosmic_workspace_handle_v1::State::Urgent) => {
|
||||
cosmic::theme::iced::Button::Destructive
|
||||
}
|
||||
None => cosmic::theme::iced::Button::Secondary,
|
||||
_ => return None,
|
||||
})
|
||||
.into(),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use cosmic::iced_widget::text;
|
||||
use cosmic::{app, iced, iced_style::application, theme::Theme};
|
||||
use freedesktop_desktop_entry::DesktopEntry;
|
||||
use std::{env, fs, process::Command};
|
||||
|
|
@ -52,8 +53,8 @@ impl cosmic::Application for Button {
|
|||
|
||||
fn view(&self) -> cosmic::Element<Msg> {
|
||||
// TODO icon?
|
||||
cosmic::widget::button(cosmic::theme::Button::Text)
|
||||
.text(&self.desktop.name)
|
||||
cosmic::widget::button(text(&self.desktop.name))
|
||||
.style(cosmic::theme::Button::Text)
|
||||
.on_press(Msg::Press)
|
||||
.into()
|
||||
}
|
||||
|
|
@ -61,8 +62,7 @@ impl cosmic::Application for Button {
|
|||
|
||||
pub fn main() -> iced::Result {
|
||||
let id = env::args()
|
||||
.skip(1)
|
||||
.next()
|
||||
.nth(1)
|
||||
.expect("Requires desktop file id as argument.");
|
||||
|
||||
let filename = format!("{id}.desktop");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue