chore: udpate libcosmic

This commit is contained in:
Ashley Wulber 2025-03-14 13:14:51 -04:00 committed by Ashley Wulber
parent 61d1d1b91d
commit c54ddeb38a
17 changed files with 139 additions and 426 deletions

81
Cargo.lock generated
View file

@ -1078,7 +1078,7 @@ dependencies = [
"cosmic-app-list-config", "cosmic-app-list-config",
"cosmic-client-toolkit", "cosmic-client-toolkit",
"cosmic-protocols", "cosmic-protocols",
"freedesktop-desktop-entry 0.7.8", "freedesktop-desktop-entry",
"futures", "futures",
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
@ -1418,12 +1418,12 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-config" name = "cosmic-config"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"atomicwrites", "atomicwrites",
"cosmic-config-derive", "cosmic-config-derive",
"cosmic-settings-daemon", "cosmic-settings-daemon",
"dirs 5.0.1", "dirs",
"futures-util", "futures-util",
"iced_futures", "iced_futures",
"known-folders", "known-folders",
@ -1440,7 +1440,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-config-derive" name = "cosmic-config-derive"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"quote", "quote",
"syn 1.0.109", "syn 1.0.109",
@ -1473,7 +1473,7 @@ name = "cosmic-freedesktop-icons"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/pop-os/freedesktop-icons#98f78d49022c893be2e974e95d95aaea963a6833" source = "git+https://github.com/pop-os/freedesktop-icons#98f78d49022c893be2e974e95d95aaea963a6833"
dependencies = [ dependencies = [
"dirs 5.0.1", "dirs",
"ini_core", "ini_core",
"once_cell", "once_cell",
"thiserror 1.0.69", "thiserror 1.0.69",
@ -1508,7 +1508,7 @@ name = "cosmic-panel-button"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"cosmic-config", "cosmic-config",
"freedesktop-desktop-entry 0.7.8", "freedesktop-desktop-entry",
"libcosmic", "libcosmic",
"once_cell", "once_cell",
"serde", "serde",
@ -1578,8 +1578,8 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-text" name = "cosmic-text"
version = "0.12.1" version = "0.13.2"
source = "git+https://github.com/pop-os/cosmic-text.git#974ddaed96b334f560b606ebe5d2ca2d2f9f23ef" source = "git+https://github.com/pop-os/cosmic-text.git#500a8fc6d172de5c9e08c6013070b6b7fcdf79dd"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"fontdb 0.16.2", "fontdb 0.16.2",
@ -1601,12 +1601,12 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-theme" name = "cosmic-theme"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"almost", "almost",
"cosmic-config", "cosmic-config",
"csscolorparser", "csscolorparser",
"dirs 5.0.1", "dirs",
"lazy_static", "lazy_static",
"palette", "palette",
"ron 0.9.0-alpha.1", "ron 0.9.0-alpha.1",
@ -1931,33 +1931,13 @@ dependencies = [
"crypto-common", "crypto-common",
] ]
[[package]]
name = "dirs"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309"
dependencies = [
"dirs-sys 0.3.7",
]
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "5.0.1" version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [ dependencies = [
"dirs-sys 0.4.1", "dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
"redox_users",
"winapi",
] ]
[[package]] [[package]]
@ -2450,19 +2430,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "freedesktop-desktop-entry"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c201444ddafb5506fe85265b48421664ff4617e3b7090ef99e42a0070c1aead0"
dependencies = [
"dirs 3.0.2",
"gettext-rs",
"memchr",
"thiserror 1.0.69",
"xdg",
]
[[package]] [[package]]
name = "freedesktop-desktop-entry" name = "freedesktop-desktop-entry"
version = "0.7.8" version = "0.7.8"
@ -2964,7 +2931,7 @@ dependencies = [
[[package]] [[package]]
name = "iced" name = "iced"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"dnd", "dnd",
"iced_accessibility", "iced_accessibility",
@ -2982,7 +2949,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_accessibility" name = "iced_accessibility"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"accesskit_winit", "accesskit_winit",
@ -2991,7 +2958,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_core" name = "iced_core"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"bytes", "bytes",
@ -3015,7 +2982,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_futures" name = "iced_futures"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"futures", "futures",
"iced_core", "iced_core",
@ -3041,7 +3008,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_graphics" name = "iced_graphics"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"bytemuck", "bytemuck",
@ -3063,7 +3030,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_renderer" name = "iced_renderer"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"iced_graphics", "iced_graphics",
"iced_tiny_skia", "iced_tiny_skia",
@ -3075,7 +3042,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_runtime" name = "iced_runtime"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"bytes", "bytes",
"cosmic-client-toolkit", "cosmic-client-toolkit",
@ -3090,7 +3057,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_tiny_skia" name = "iced_tiny_skia"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cosmic-text", "cosmic-text",
@ -3106,7 +3073,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_wgpu" name = "iced_wgpu"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"as-raw-xcb-connection", "as-raw-xcb-connection",
"bitflags 2.8.0", "bitflags 2.8.0",
@ -3137,7 +3104,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_widget" name = "iced_widget"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"cosmic-client-toolkit", "cosmic-client-toolkit",
"dnd", "dnd",
@ -3155,7 +3122,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_winit" name = "iced_winit"
version = "0.14.0-dev" version = "0.14.0-dev"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"cosmic-client-toolkit", "cosmic-client-toolkit",
"dnd", "dnd",
@ -3889,7 +3856,7 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]] [[package]]
name = "libcosmic" name = "libcosmic"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#50d2104485649bdddf1247f63ec3cf2eb81c5817" source = "git+https://github.com/pop-os/libcosmic#337b80d4ca02a63631668212bccbace22b8bb49f"
dependencies = [ dependencies = [
"apply", "apply",
"ashpd 0.9.2", "ashpd 0.9.2",
@ -3902,7 +3869,7 @@ dependencies = [
"cosmic-theme", "cosmic-theme",
"css-color", "css-color",
"derive_setters", "derive_setters",
"freedesktop-desktop-entry 0.5.2", "freedesktop-desktop-entry",
"iced", "iced",
"iced_core", "iced_core",
"iced_futures", "iced_futures",

View file

@ -69,15 +69,14 @@ serde = { version = "1.0.217", features = ["derive"] }
freedesktop-desktop-entry = "0.7.8" freedesktop-desktop-entry = "0.7.8"
[profile.release] [profile.release]
# lto = "fat" lto = "fat"
opt-level = 1
[workspace.metadata.cargo-machete] [workspace.metadata.cargo-machete]
ignored = ["libcosmic"] ignored = ["libcosmic"]
[patch."https://github.com/pop-os/libcosmic"] # [patch."https://github.com/pop-os/libcosmic"]
cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "drop-menu-tree-changes" } # cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "drop-menu-tree-changes" }
libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "drop-menu-tree-changes" } # libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "drop-menu-tree-changes" }
iced_futures = { git = "https://github.com/pop-os/libcosmic//", branch = "drop-menu-tree-changes" } # iced_futures = { git = "https://github.com/pop-os/libcosmic//", branch = "drop-menu-tree-changes" }
# cosmic-config = { path = "../libcosmic/cosmic-config" } # cosmic-config = { path = "../libcosmic/cosmic-config" }
# libcosmic = { path = "../libcosmic" } # libcosmic = { path = "../libcosmic" }

View file

@ -20,6 +20,7 @@ use cctk::{
}, },
}; };
use cosmic::{ use cosmic::{
app,
applet::{ applet::{
cosmic_panel_config::{PanelAnchor, PanelSize}, cosmic_panel_config::{PanelAnchor, PanelSize},
Context, Size, Context, Size,
@ -36,7 +37,7 @@ use cosmic::{
}, },
iced_core::{Border, Padding, Shadow}, iced_core::{Border, Padding, Shadow},
iced_runtime::{core::event, dnd::peek_dnd}, iced_runtime::{core::event, dnd::peek_dnd},
surface_message::{MessageWrapper, SurfaceMessage}, surface,
theme::{self, Button, Container}, theme::{self, Button, Container},
widget::{ widget::{
button, divider, dnd_source, horizontal_space, button, divider, dnd_source, horizontal_space,
@ -372,22 +373,7 @@ enum Message {
ConfigUpdated(AppListConfig), ConfigUpdated(AppListConfig),
OpenFavorites, OpenFavorites,
OpenActive, OpenActive,
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
fn index_in_list( fn index_in_list(
@ -606,10 +592,7 @@ impl cosmic::Application for CosmicAppList {
type Flags = (); type Flags = ();
const APP_ID: &'static str = APP_ID; const APP_ID: &'static str = APP_ID;
fn init( fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (Self, iced::Task<cosmic::app::Message<Self::Message>>) {
let config = Config::new(APP_ID, AppListConfig::VERSION) let config = Config::new(APP_ID, AppListConfig::VERSION)
.ok() .ok()
.and_then(|c| AppListConfig::get_entry(&c).ok()) .and_then(|c| AppListConfig::get_entry(&c).ok())
@ -639,7 +622,7 @@ impl cosmic::Application for CosmicAppList {
( (
app_list, app_list,
Task::perform(try_get_gpus(), |gpus| { Task::perform(try_get_gpus(), |gpus| {
cosmic::app::Message::App(Message::GpuRequest(gpus)) cosmic::Action::App(Message::GpuRequest(gpus))
}), }),
) )
} }
@ -652,10 +635,7 @@ impl cosmic::Application for CosmicAppList {
&mut self.core &mut self.core
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> iced::Task<cosmic::app::Message<Self::Message>> {
match message { match message {
Message::Popup(id, parent_window_id) => { Message::Popup(id, parent_window_id) => {
if let Some(Popup { if let Some(Popup {
@ -715,7 +695,7 @@ impl cosmic::Application for CosmicAppList {
}; };
let gpu_update = Task::perform(try_get_gpus(), |gpus| { let gpu_update = Task::perform(try_get_gpus(), |gpus| {
cosmic::app::Message::App(Message::GpuRequest(gpus)) cosmic::Action::App(Message::GpuRequest(gpus))
}); });
return Task::batch([gpu_update, get_popup(popup_settings)]); return Task::batch([gpu_update, get_popup(popup_settings)]);
} }
@ -939,7 +919,7 @@ impl cosmic::Application for CosmicAppList {
// TODO dnd // TODO dnd
return peek_dnd::<DndPathBuf>() return peek_dnd::<DndPathBuf>()
.map(Message::DndData) .map(Message::DndData)
.map(cosmic::app::Message::App); .map(cosmic::Action::App);
} }
} }
Message::DndMotion(x, y) => { Message::DndMotion(x, y) => {
@ -1067,7 +1047,7 @@ impl cosmic::Application for CosmicAppList {
}, },
|_| Message::IncrementSubscriptionCtr, |_| Message::IncrementSubscriptionCtr,
) )
.map(cosmic::app::message::app); .map(cosmic::action::app);
} }
WaylandUpdate::Toplevel(event) => match event { WaylandUpdate::Toplevel(event) => match event {
ToplevelUpdate::Add(mut info) => { ToplevelUpdate::Add(mut info) => {
@ -1370,7 +1350,11 @@ impl cosmic::Application for CosmicAppList {
return self.close_popups(); return self.close_popups();
} }
} }
Message::Surface(surface_message) => {} Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
}
} }
Task::none() Task::none()
@ -1419,7 +1403,7 @@ impl cosmic::Application for CosmicAppList {
.map(|dock_item| { .map(|dock_item| {
self.core self.core
.applet .applet
.applet_tooltip( .applet_tooltip::<Message>(
dock_item.as_icon( dock_item.as_icon(
&self.core.applet, &self.core.applet,
self.rectangle_tracker.as_ref(), self.rectangle_tracker.as_ref(),
@ -1439,6 +1423,7 @@ impl cosmic::Application for CosmicAppList {
.unwrap_or_default() .unwrap_or_default()
.to_string(), .to_string(),
self.popup.is_some(), self.popup.is_some(),
Message::Surface,
) )
.into() .into()
}) })
@ -1532,6 +1517,7 @@ impl cosmic::Application for CosmicAppList {
.unwrap_or_default() .unwrap_or_default()
.to_string(), .to_string(),
self.popup.is_some(), self.popup.is_some(),
Message::Surface,
) )
.into() .into()
}) })
@ -1948,6 +1934,7 @@ impl cosmic::Application for CosmicAppList {
.unwrap_or_default() .unwrap_or_default()
.to_string(), .to_string(),
self.popup.is_some(), self.popup.is_some(),
Message::Surface,
) )
.into() .into()
}) })
@ -2046,6 +2033,7 @@ impl cosmic::Application for CosmicAppList {
.unwrap_or_default() .unwrap_or_default()
.to_string(), .to_string(),
self.popup.is_some(), self.popup.is_some(),
Message::Surface,
) )
.into() .into()
}) })
@ -2130,7 +2118,7 @@ impl cosmic::Application for CosmicAppList {
impl CosmicAppList { impl CosmicAppList {
/// Close any open popups. /// Close any open popups.
fn close_popups(&mut self) -> Task<cosmic::app::Message<Message>> { fn close_popups(&mut self) -> Task<cosmic::Action<Message>> {
let mut commands = Vec::new(); let mut commands = Vec::new();
if let Some(popup) = self.popup.take() { if let Some(popup) = self.popup.take() {
commands.push(destroy_popup(popup.id)); commands.push(destroy_popup(popup.id));

View file

@ -10,6 +10,7 @@ use crate::{
fl, fl,
}; };
use cosmic::{ use cosmic::{
app,
applet::{ applet::{
menu_button, padded_control, menu_button, padded_control,
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate}, token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
@ -22,8 +23,7 @@ use cosmic::{
}, },
iced_runtime::core::layout::Limits, iced_runtime::core::layout::Limits,
iced_widget::column, iced_widget::column,
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{divider, text}, widget::{divider, text},
Element, Task, Element, Task,
}; };
@ -60,22 +60,7 @@ enum Message {
OpenSettings, OpenSettings,
DBusUpdate(DBusUpdate), DBusUpdate(DBusUpdate),
WaylandUpdate(WaylandUpdate), WaylandUpdate(WaylandUpdate),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for CosmicA11yApplet { impl cosmic::Application for CosmicA11yApplet {
@ -84,13 +69,7 @@ impl cosmic::Application for CosmicA11yApplet {
type Flags = (); type Flags = ();
const APP_ID: &'static str = "com.system76.CosmicAppletA11y"; const APP_ID: &'static str = "com.system76.CosmicAppletA11y";
fn init( fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (
Self,
cosmic::iced::Task<cosmic::app::Message<Self::Message>>,
) {
( (
Self { Self {
core, core,
@ -110,10 +89,7 @@ impl cosmic::Application for CosmicA11yApplet {
&mut self.core &mut self.core
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> cosmic::iced::Task<cosmic::app::Message<Self::Message>> {
match message { match message {
Message::Frame(now) => self.timeline.now(now), Message::Frame(now) => self.timeline.now(now),
Message::ScreenReaderEnabled(chain, enabled) => { Message::ScreenReaderEnabled(chain, enabled) => {
@ -214,7 +190,11 @@ impl cosmic::Application for CosmicA11yApplet {
self.wayland_sender = Some(tx); self.wayland_sender = Some(tx);
} }
}, },
Message::Surface(surface_message) => {} Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
}
} }
Task::none() Task::none()
} }

View file

@ -23,8 +23,7 @@ use cosmic::{
widget::{self, column, row, slider}, widget::{self, column, row, slider},
window, Alignment, Length, Limits, Subscription, window, Alignment, Length, Limits, Subscription,
}, },
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{button, divider, horizontal_space, icon, text, Column, Row}, widget::{button, divider, horizontal_space, icon, text, Column, Row},
Element, Renderer, Task, Theme, Element, Renderer, Task, Theme,
}; };
@ -163,22 +162,7 @@ pub enum Message {
Token(TokenUpdate), Token(TokenUpdate),
OpenSettings, OpenSettings,
PulseSub(sub_pulse::Event), PulseSub(sub_pulse::Event),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl Audio { impl Audio {
@ -687,7 +671,11 @@ impl cosmic::Application for Audio {
sub_pulse::Event::DefaultSource(_) => {} sub_pulse::Event::DefaultSource(_) => {}
sub_pulse::Event::CardInfo(_) => {} sub_pulse::Event::CardInfo(_) => {}
}, },
Message::Surface(surface_message) => {} Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
}
}; };
Task::none() Task::none()

View file

@ -11,6 +11,7 @@ use crate::{
fl, fl,
}; };
use cosmic::{ use cosmic::{
app,
applet::{ applet::{
cosmic_panel_config::PanelAnchor, cosmic_panel_config::PanelAnchor,
menu_button, padded_control, menu_button, padded_control,
@ -26,8 +27,7 @@ use cosmic::{
iced_core::{Alignment, Background, Border, Color, Shadow}, iced_core::{Alignment, Background, Border, Color, Shadow},
iced_runtime::core::layout::Limits, iced_runtime::core::layout::Limits,
iced_widget::{Column, Row}, iced_widget::{Column, Row},
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{divider, horizontal_space, icon, scrollable, text, vertical_space}, widget::{divider, horizontal_space, icon, scrollable, text, vertical_space},
Element, Task, Element, Task,
}; };
@ -189,22 +189,7 @@ enum Message {
OpenSettings, OpenSettings,
SettingsDaemon(settings_daemon::Event), SettingsDaemon(settings_daemon::Event),
ZbusConnection(zbus::Result<zbus::Connection>), ZbusConnection(zbus::Result<zbus::Connection>),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for CosmicBatteryApplet { impl cosmic::Application for CosmicBatteryApplet {
@ -213,18 +198,12 @@ impl cosmic::Application for CosmicBatteryApplet {
type Flags = (); type Flags = ();
const APP_ID: &'static str = config::APP_ID; const APP_ID: &'static str = config::APP_ID;
fn init( fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: cosmic::app::Core, let zbus_session_cmd = Task::perform(zbus::Connection::session(), |res| {
_flags: Self::Flags, cosmic::Action::App(Message::ZbusConnection(res))
) -> (
Self,
cosmic::iced::Task<cosmic::app::Message<Self::Message>>,
) {
let zbus_session_cmd = cosmic::iced::Task::perform(zbus::Connection::session(), |res| {
cosmic::app::Message::App(Message::ZbusConnection(res))
}); });
let init_charging_limit_cmd = cosmic::iced::Task::perform(get_charging_limit(), |limit| { let init_charging_limit_cmd = Task::perform(get_charging_limit(), |limit| {
cosmic::app::Message::App(Message::InitChargingLimit(limit)) cosmic::Action::App(Message::InitChargingLimit(limit))
}); });
( (
Self { Self {
@ -247,10 +226,7 @@ impl cosmic::Application for CosmicBatteryApplet {
&mut self.core &mut self.core
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> cosmic::iced::Task<cosmic::app::Message<Self::Message>> {
match message { match message {
Message::Frame(now) => self.timeline.now(now), Message::Frame(now) => self.timeline.now(now),
Message::SetKbdBrightness(brightness) => { Message::SetKbdBrightness(brightness) => {
@ -280,7 +256,7 @@ impl cosmic::Application for CosmicBatteryApplet {
} }
return cosmic::iced::Task::perform( return cosmic::iced::Task::perform(
tokio::time::sleep(Duration::from_millis(200)), tokio::time::sleep(Duration::from_millis(200)),
|_| cosmic::app::Message::App(Message::SetKbdBrightnessDebounced), |_| cosmic::Action::App(Message::SetKbdBrightnessDebounced),
); );
} }
Message::SetScreenBrightnessDebounced => { Message::SetScreenBrightnessDebounced => {
@ -295,7 +271,7 @@ impl cosmic::Application for CosmicBatteryApplet {
} }
return cosmic::iced::Task::perform( return cosmic::iced::Task::perform(
tokio::time::sleep(Duration::from_millis(200)), tokio::time::sleep(Duration::from_millis(200)),
|_| cosmic::app::Message::App(Message::SetScreenBrightnessDebounced), |_| cosmic::Action::App(Message::SetScreenBrightnessDebounced),
); );
} }
Message::ReleaseKbdBrightness => { Message::ReleaseKbdBrightness => {
@ -325,7 +301,7 @@ impl cosmic::Application for CosmicBatteryApplet {
if enable { if enable {
return cosmic::iced::Task::perform(set_charging_limit(), |_| { return cosmic::iced::Task::perform(set_charging_limit(), |_| {
cosmic::app::Message::None cosmic::Action::None
}); });
} }
} }

View file

@ -3,9 +3,10 @@
use crate::bluetooth::{BluerDeviceStatus, BluerRequest, BluerState, DeviceProperty}; use crate::bluetooth::{BluerDeviceStatus, BluerRequest, BluerState, DeviceProperty};
use cosmic::{ use cosmic::{
app,
applet::token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate}, applet::token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
cctk::sctk::reexports::calloop, cctk::sctk::reexports::calloop,
surface_message::{MessageWrapper, SurfaceMessage}, surface,
}; };
use cosmic::{ use cosmic::{
@ -76,22 +77,7 @@ enum Message {
OpenSettings, OpenSettings,
Frame(Instant), Frame(Instant),
ToggleBluetooth(chain::Toggler, bool), ToggleBluetooth(chain::Toggler, bool),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for CosmicBluetoothApplet { impl cosmic::Application for CosmicBluetoothApplet {
@ -100,10 +86,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
type Flags = (); type Flags = ();
const APP_ID: &'static str = config::APP_ID; const APP_ID: &'static str = config::APP_ID;
fn init( fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (Self, iced::Task<cosmic::app::Message<Self::Message>>) {
( (
Self { Self {
core, core,
@ -123,10 +106,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
&mut self.core &mut self.core
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> iced::Task<cosmic::app::Message<Self::Message>> {
match message { match message {
Message::TogglePopup => { Message::TogglePopup => {
if let Some(p) = self.popup.take() { if let Some(p) = self.popup.take() {
@ -153,7 +133,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
let _ = tx.send(BluerRequest::StateUpdate).await; let _ = tx.send(BluerRequest::StateUpdate).await;
} }
}, },
|_| cosmic::app::message::app(Message::Ignore), |_| cosmic::action::app(Message::Ignore),
), ),
get_popup(popup_settings), get_popup(popup_settings),
]); ]);

View file

@ -4,8 +4,8 @@
mod localize; mod localize;
use cosmic::iced::{Alignment, Length}; use cosmic::iced::{Alignment, Length};
use cosmic::surface_message::{MessageWrapper, SurfaceMessage};
use cosmic::{ use cosmic::{
app,
app::Core, app::Core,
applet::{self}, applet::{self},
cosmic_config::{self, ConfigSet, CosmicConfigEntry}, cosmic_config::{self, ConfigSet, CosmicConfigEntry},
@ -19,7 +19,7 @@ use cosmic::{
iced_futures::Subscription, iced_futures::Subscription,
iced_runtime::{core::window, Appearance}, iced_runtime::{core::window, Appearance},
prelude::*, prelude::*,
theme, surface, theme,
widget::{self, horizontal_space, vertical_space}, widget::{self, horizontal_space, vertical_space},
}; };
use cosmic_comp_config::CosmicCompConfig; use cosmic_comp_config::CosmicCompConfig;
@ -86,22 +86,7 @@ pub enum Message {
CompConfig(Box<CosmicCompConfig>), CompConfig(Box<CosmicCompConfig>),
SetActiveLayout(usize), SetActiveLayout(usize),
KeyboardSettings, KeyboardSettings,
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
#[derive(Debug)] #[derive(Debug)]
@ -126,7 +111,7 @@ impl cosmic::Application for Window {
&mut self.core &mut self.core
} }
fn init(core: Core, flags: Self::Flags) -> (Self, Task<cosmic::app::Message<Self::Message>>) { fn init(core: Core, flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
let window = Window { let window = Window {
comp_config_handler: flags.comp_config_handler, comp_config_handler: flags.comp_config_handler,
layouts: flags.layouts, layouts: flags.layouts,
@ -142,7 +127,7 @@ impl cosmic::Application for Window {
Some(Message::PopupClosed(id)) Some(Message::PopupClosed(id))
} }
fn update(&mut self, message: Self::Message) -> Task<cosmic::app::Message<Self::Message>> { fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
match message { match message {
Message::TogglePopup => { Message::TogglePopup => {
return if let Some(p) = self.popup.take() { return if let Some(p) = self.popup.take() {

View file

@ -23,7 +23,7 @@ use cosmic::{
window::{self}, window::{self},
Length, Limits, Subscription, Length, Limits, Subscription,
}, },
surface_message::{MessageWrapper, SurfaceMessage}, surface,
widget::{autosize::autosize, mouse_area}, widget::{autosize::autosize, mouse_area},
Task, Task,
}; };
@ -83,22 +83,7 @@ enum Message {
Closed(window::Id), Closed(window::Id),
OpenOverflowPopup, OpenOverflowPopup,
CloseOverflowPopup, CloseOverflowPopup,
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for Minimize { impl cosmic::Application for Minimize {
@ -264,6 +249,7 @@ impl cosmic::Application for Minimize {
)), )),
data.name.clone(), data.name.clone(),
self.overflow_popup.is_some(), self.overflow_popup.is_some(),
Message::Surface,
) )
.into() .into()
}); });

View file

@ -15,8 +15,7 @@ use cosmic::{
}, },
iced_runtime::core::{layout::Limits, window}, iced_runtime::core::{layout::Limits, window},
iced_widget::Row, iced_widget::Row,
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{ widget::{
button, container, divider, button, container, divider,
icon::{self, from_name}, icon::{self, from_name},
@ -243,22 +242,7 @@ pub(crate) enum Message {
ResetFailedKnownSsid(String, HwAddress), ResetFailedKnownSsid(String, HwAddress),
OpenHwDevice(Option<HwAddress>), OpenHwDevice(Option<HwAddress>),
TogglePasswordVisibility, TogglePasswordVisibility,
Surface(SurfaceMessage), // Errored(String), Surface(surface::Action), // Errored(String),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for CosmicNetworkApplet { impl cosmic::Application for CosmicNetworkApplet {

View file

@ -4,6 +4,7 @@
mod localize; mod localize;
mod subscriptions; mod subscriptions;
use cosmic::{ use cosmic::{
app,
applet::{ applet::{
menu_control_padding, padded_control, menu_control_padding, padded_control,
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate}, token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
@ -17,8 +18,7 @@ use cosmic::{
window, Alignment, Length, Limits, Subscription, window, Alignment, Length, Limits, Subscription,
}, },
iced_widget::{scrollable, Column}, iced_widget::{scrollable, Column},
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{button, container, divider, icon, text}, widget::{button, container, divider, icon, text},
Element, Task, Element, Task,
}; };
@ -95,22 +95,7 @@ enum Message {
CardsToggled(String, bool), CardsToggled(String, bool),
Token(TokenUpdate), Token(TokenUpdate),
OpenSettings, OpenSettings,
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for Notifications { impl cosmic::Application for Notifications {
@ -119,13 +104,7 @@ impl cosmic::Application for Notifications {
type Flags = (); type Flags = ();
const APP_ID: &'static str = "com.system76.CosmicAppletNotifications"; const APP_ID: &'static str = "com.system76.CosmicAppletNotifications";
fn init( fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (
Self,
cosmic::iced::Task<cosmic::app::Message<Self::Message>>,
) {
let helper = Config::new( let helper = Config::new(
cosmic_notifications_config::ID, cosmic_notifications_config::ID,
NotificationsConfig::VERSION, NotificationsConfig::VERSION,
@ -193,10 +172,7 @@ impl cosmic::Application for Notifications {
]) ])
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> cosmic::iced::Task<cosmic::app::Message<Self::Message>> {
match message { match message {
Message::Frame(now) => { Message::Frame(now) => {
self.timeline.now(now); self.timeline.now(now);

View file

@ -18,8 +18,7 @@ use cosmic::{
window, Alignment, Length, window, Alignment, Length,
}, },
iced_runtime::core::layout::Limits, iced_runtime::core::layout::Limits,
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{autosize, button, divider, icon, layer_container::layer_container, text, Space}, widget::{autosize, button, divider, icon, layer_container::layer_container, text, Space},
Element, Task, Element, Task,
}; };
@ -66,8 +65,8 @@ enum PowerAction {
} }
impl PowerAction { impl PowerAction {
fn perform(self) -> iced::Task<cosmic::app::Message<Message>> { fn perform(self) -> iced::Task<cosmic::Action<Message>> {
let msg = |m| cosmic::app::message::app(Message::Zbus(m)); let msg = |m| cosmic::action::app(Message::Zbus(m));
match self { match self {
PowerAction::Lock => iced::Task::perform(lock(), msg), PowerAction::Lock => iced::Task::perform(lock(), msg),
PowerAction::LogOut => iced::Task::perform(log_out(), msg), PowerAction::LogOut => iced::Task::perform(log_out(), msg),
@ -77,20 +76,6 @@ impl PowerAction {
} }
} }
} }
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum Message { enum Message {
@ -99,7 +84,7 @@ enum Message {
Settings, Settings,
Zbus(Result<(), zbus::Error>), Zbus(Result<(), zbus::Error>),
Closed(window::Id), Closed(window::Id),
Surface(SurfaceMessage), Surface(surface::Action),
} }
impl cosmic::Application for Power { impl cosmic::Application for Power {

View file

@ -9,7 +9,7 @@ use cosmic::{
platform_specific::shell::commands::popup::{destroy_popup, get_popup}, platform_specific::shell::commands::popup::{destroy_popup, get_popup},
window, Limits, Padding, Subscription, window, Limits, Padding, Subscription,
}, },
surface_message::{MessageWrapper, SurfaceMessage}, surface,
widget::{container, mouse_area}, widget::{container, mouse_area},
Element, Task, Element, Task,
}; };
@ -25,22 +25,7 @@ pub enum Msg {
StatusNotifier(status_notifier_watcher::Event), StatusNotifier(status_notifier_watcher::Event),
TogglePopup(usize), TogglePopup(usize),
Hovered(usize), Hovered(usize),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Msg> for MessageWrapper<Msg> {
fn from(value: Msg) -> Self {
match value {
Msg::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Msg {
fn from(value: SurfaceMessage) -> Self {
Msg::Surface(value)
}
} }
#[derive(Default)] #[derive(Default)]
@ -114,7 +99,7 @@ impl cosmic::Application for App {
Msg::StatusMenu((id, msg)) => match self.menus.get_mut(&id) { Msg::StatusMenu((id, msg)) => match self.menus.get_mut(&id) {
Some(state) => state Some(state) => state
.update(msg) .update(msg)
.map(move |msg| app::message::app(Msg::StatusMenu((id, msg)))), .map(move |msg| cosmic::action::app(Msg::StatusMenu((id, msg)))),
None => Task::none(), None => Task::none(),
}, },
Msg::StatusNotifier(event) => match event { Msg::StatusNotifier(event) => match event {
@ -131,13 +116,13 @@ impl cosmic::Application for App {
{ {
*m = state; *m = state;
let id = *id; let id = *id;
return cmd.map(move |msg| app::message::app(Msg::StatusMenu((id, msg)))); return cmd.map(move |msg| cosmic::action::app(Msg::StatusMenu((id, msg))));
} }
let id = self.next_menu_id(); let id = self.next_menu_id();
self.menus.insert(id, state); self.menus.insert(id, state);
app::Task::batch([ app::Task::batch([
self.resize_window(), self.resize_window(),
cmd.map(move |msg| app::message::app(Msg::StatusMenu((id, msg)))), cmd.map(move |msg| cosmic::action::app(Msg::StatusMenu((id, msg)))),
]) ])
} }
status_notifier_watcher::Event::Unregistered(name) => { status_notifier_watcher::Event::Unregistered(name) => {
@ -241,9 +226,13 @@ impl cosmic::Application for App {
popup_settings.positioner.anchor_rect.x = i as i32 * suggested_size as i32; popup_settings.positioner.anchor_rect.x = i as i32 * suggested_size as i32;
} }
cmds.push(get_popup(popup_settings)); cmds.push(get_popup(popup_settings));
app::Task::batch(cmds) Task::batch(cmds)
}
Msg::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
} }
Msg::Surface(surface_message) => unreachable!(),
} }
} }

View file

@ -6,6 +6,7 @@ use crate::{
}; };
use cctk::sctk::reexports::calloop::channel::SyncSender; use cctk::sctk::reexports::calloop::channel::SyncSender;
use cosmic::{ use cosmic::{
app,
app::Core, app::Core,
applet::{menu_button, padded_control}, applet::{menu_button, padded_control},
cosmic_config::{Config, ConfigSet, CosmicConfigEntry}, cosmic_config::{Config, ConfigSet, CosmicConfigEntry},
@ -13,17 +14,16 @@ use cosmic::{
iced::{ iced::{
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup}, platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
window::Id, window::Id,
Length, Limits, Subscription, Task, Length, Limits, Subscription,
}, },
iced_widget::{column, row}, iced_widget::{column, row},
surface_message::{MessageWrapper, SurfaceMessage}, surface, theme,
theme,
widget::{ widget::{
container, divider, container, divider,
segmented_button::{self, Entity, SingleSelectModel}, segmented_button::{self, Entity, SingleSelectModel},
segmented_control, text, segmented_control, text,
}, },
Element, Element, Task,
}; };
use cosmic_comp_config::{CosmicCompConfig, TileBehavior}; use cosmic_comp_config::{CosmicCompConfig, TileBehavior};
use cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2::TilingState; use cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2::TilingState;
@ -61,22 +61,7 @@ pub enum Message {
WorkspaceUpdate(WorkspacesUpdate), WorkspaceUpdate(WorkspacesUpdate),
NewWorkspace(Entity), NewWorkspace(Entity),
OpenSettings, OpenSettings,
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for Window { impl cosmic::Application for Window {
@ -93,7 +78,7 @@ impl cosmic::Application for Window {
&mut self.core &mut self.core
} }
fn init(core: Core, _flags: Self::Flags) -> (Self, Task<cosmic::app::Message<Self::Message>>) { fn init(core: Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
let config_helper = let config_helper =
Config::new("com.system76.CosmicComp", CosmicCompConfig::VERSION).unwrap(); Config::new("com.system76.CosmicComp", CosmicCompConfig::VERSION).unwrap();
let mut config = CosmicCompConfig::get_entry(&config_helper).unwrap_or_else(|(errs, c)| { let mut config = CosmicCompConfig::get_entry(&config_helper).unwrap_or_else(|(errs, c)| {
@ -157,7 +142,7 @@ impl cosmic::Application for Window {
]) ])
} }
fn update(&mut self, message: Self::Message) -> Task<cosmic::app::Message<Self::Message>> { fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
match message { match message {
Message::WorkspaceUpdate(msg) => match msg { Message::WorkspaceUpdate(msg) => match msg {
WorkspacesUpdate::State(state) => { WorkspacesUpdate::State(state) => {

View file

@ -5,7 +5,6 @@ use std::str::FromStr;
use chrono::{Datelike, Timelike}; use chrono::{Datelike, Timelike};
use cosmic::iced_futures::stream; use cosmic::iced_futures::stream;
use cosmic::surface_message::{MessageWrapper, SurfaceMessage};
use cosmic::widget::Id; use cosmic::widget::Id;
use cosmic::{ use cosmic::{
app, app,
@ -19,7 +18,7 @@ use cosmic::{
window, Alignment, Length, Rectangle, Subscription, window, Alignment, Length, Rectangle, Subscription,
}, },
iced_widget::{horizontal_rule, Column}, iced_widget::{horizontal_rule, Column},
theme, surface, theme,
widget::{ widget::{
autosize, button, container, divider, grid, horizontal_space, icon, rectangle_tracker::*, autosize, button, container, divider, grid, horizontal_space, icon, rectangle_tracker::*,
text, Button, Grid, Space, text, Button, Grid, Space,
@ -80,22 +79,7 @@ pub enum Message {
Token(TokenUpdate), Token(TokenUpdate),
ConfigChanged(TimeAppletConfig), ConfigChanged(TimeAppletConfig),
TimezoneUpdate(String), TimezoneUpdate(String),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl Window { impl Window {
@ -131,10 +115,7 @@ impl cosmic::Application for Window {
type Flags = (); type Flags = ();
const APP_ID: &'static str = "com.system76.CosmicAppletTime"; const APP_ID: &'static str = "com.system76.CosmicAppletTime";
fn init( fn init(core: app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: app::Core,
_flags: Self::Flags,
) -> (Self, cosmic::iced::Task<app::Message<Self::Message>>) {
fn get_local() -> Result<Locale, Box<dyn std::error::Error>> { fn get_local() -> Result<Locale, Box<dyn std::error::Error>> {
let locale = std::env::var("LC_TIME").or_else(|_| std::env::var("LANG"))?; let locale = std::env::var("LC_TIME").or_else(|_| std::env::var("LANG"))?;
let locale = locale let locale = locale
@ -312,10 +293,7 @@ impl cosmic::Application for Window {
]) ])
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> cosmic::iced::Task<app::Message<Self::Message>> {
match message { match message {
Message::TogglePopup => { Message::TogglePopup => {
if let Some(p) = self.popup.take() { if let Some(p) = self.popup.take() {

View file

@ -11,6 +11,7 @@ use cctk::{
workspace::Workspace, workspace::Workspace,
}; };
use cosmic::{ use cosmic::{
app,
applet::cosmic_panel_config::PanelAnchor, applet::cosmic_panel_config::PanelAnchor,
iced::{ iced::{
event, event,
@ -21,7 +22,7 @@ use cosmic::{
Length, Limits, Subscription, Length, Limits, Subscription,
}, },
iced_core::{Background, Border}, iced_core::{Background, Border},
surface_message::{MessageWrapper, SurfaceMessage}, surface,
widget::{autosize, container, horizontal_space, vertical_space, Id}, widget::{autosize, container, horizontal_space, vertical_space, Id},
Element, Task, Theme, Element, Task, Theme,
}; };
@ -94,22 +95,7 @@ enum Message {
WorkspacePressed(ExtWorkspaceHandleV1), WorkspacePressed(ExtWorkspaceHandleV1),
WheelScrolled(ScrollDelta), WheelScrolled(ScrollDelta),
WorkspaceOverview, WorkspaceOverview,
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
} }
impl cosmic::Application for IcedWorkspacesApplet { impl cosmic::Application for IcedWorkspacesApplet {
@ -118,13 +104,7 @@ impl cosmic::Application for IcedWorkspacesApplet {
type Flags = (); type Flags = ();
const APP_ID: &'static str = config::APP_ID; const APP_ID: &'static str = config::APP_ID;
fn init( fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (
Self,
cosmic::iced::Task<cosmic::app::Message<Self::Message>>,
) {
( (
Self { Self {
layout: match &core.applet.anchor { layout: match &core.applet.anchor {
@ -150,10 +130,7 @@ impl cosmic::Application for IcedWorkspacesApplet {
&mut self.core &mut self.core
} }
fn update( fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
&mut self,
message: Self::Message,
) -> cosmic::iced::Task<cosmic::app::Message<Self::Message>> {
match message { match message {
Message::WorkspaceUpdate(msg) => match msg { Message::WorkspaceUpdate(msg) => match msg {
WorkspacesUpdate::Workspaces(mut list) => { WorkspacesUpdate::Workspaces(mut list) => {

View file

@ -10,7 +10,7 @@ use cosmic::{
}, },
iced::{self, Length}, iced::{self, Length},
iced_widget::row, iced_widget::row,
surface_message::{MessageWrapper, SurfaceMessage}, surface,
widget::{autosize, vertical_space, Id}, widget::{autosize, vertical_space, Id},
Task, Task,
}; };
@ -40,22 +40,7 @@ struct Button {
enum Msg { enum Msg {
Press, Press,
ConfigUpdated(CosmicPanelButtonConfig), ConfigUpdated(CosmicPanelButtonConfig),
Surface(SurfaceMessage), Surface(surface::Action),
}
impl From<Msg> for MessageWrapper<Msg> {
fn from(value: Msg) -> Self {
match value {
Msg::Surface(s) => MessageWrapper::Surface(s),
m => MessageWrapper::Message(m),
}
}
}
impl From<SurfaceMessage> for Msg {
fn from(value: SurfaceMessage) -> Self {
Msg::Surface(value)
}
} }
impl cosmic::Application for Button { impl cosmic::Application for Button {
@ -111,7 +96,11 @@ impl cosmic::Application for Button {
.cloned() .cloned()
.unwrap_or_default(); .unwrap_or_default();
} }
Msg::Surface(_) => unreachable!(), Msg::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
}
} }
Task::none() Task::none()
} }
@ -136,7 +125,7 @@ impl cosmic::Application for Button {
) )
{ {
cosmic::Element::from( cosmic::Element::from(
self.core.applet.applet_tooltip( self.core.applet.applet_tooltip::<Msg>(
self.core self.core
.applet .applet
.icon_button_from_handle( .icon_button_from_handle(
@ -146,6 +135,7 @@ impl cosmic::Application for Button {
.on_press_down(Msg::Press), .on_press_down(Msg::Press),
self.desktop.name.clone(), self.desktop.name.clone(),
false, false,
Msg::Surface,
), ),
) )
} else { } else {