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

View file

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

View file

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

View file

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

View file

@ -23,8 +23,7 @@ use cosmic::{
widget::{self, column, row, slider},
window, Alignment, Length, Limits, Subscription,
},
surface_message::{MessageWrapper, SurfaceMessage},
theme,
surface, theme,
widget::{button, divider, horizontal_space, icon, text, Column, Row},
Element, Renderer, Task, Theme,
};
@ -163,22 +162,7 @@ pub enum Message {
Token(TokenUpdate),
OpenSettings,
PulseSub(sub_pulse::Event),
Surface(SurfaceMessage),
}
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)
}
Surface(surface::Action),
}
impl Audio {
@ -687,7 +671,11 @@ impl cosmic::Application for Audio {
sub_pulse::Event::DefaultSource(_) => {}
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()

View file

@ -11,6 +11,7 @@ use crate::{
fl,
};
use cosmic::{
app,
applet::{
cosmic_panel_config::PanelAnchor,
menu_button, padded_control,
@ -26,8 +27,7 @@ use cosmic::{
iced_core::{Alignment, Background, Border, Color, Shadow},
iced_runtime::core::layout::Limits,
iced_widget::{Column, Row},
surface_message::{MessageWrapper, SurfaceMessage},
theme,
surface, theme,
widget::{divider, horizontal_space, icon, scrollable, text, vertical_space},
Element, Task,
};
@ -189,22 +189,7 @@ enum Message {
OpenSettings,
SettingsDaemon(settings_daemon::Event),
ZbusConnection(zbus::Result<zbus::Connection>),
Surface(SurfaceMessage),
}
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)
}
Surface(surface::Action),
}
impl cosmic::Application for CosmicBatteryApplet {
@ -213,18 +198,12 @@ impl cosmic::Application for CosmicBatteryApplet {
type Flags = ();
const APP_ID: &'static str = config::APP_ID;
fn init(
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (
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))
fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
let zbus_session_cmd = Task::perform(zbus::Connection::session(), |res| {
cosmic::Action::App(Message::ZbusConnection(res))
});
let init_charging_limit_cmd = cosmic::iced::Task::perform(get_charging_limit(), |limit| {
cosmic::app::Message::App(Message::InitChargingLimit(limit))
let init_charging_limit_cmd = Task::perform(get_charging_limit(), |limit| {
cosmic::Action::App(Message::InitChargingLimit(limit))
});
(
Self {
@ -247,10 +226,7 @@ impl cosmic::Application for CosmicBatteryApplet {
&mut self.core
}
fn update(
&mut self,
message: Self::Message,
) -> cosmic::iced::Task<cosmic::app::Message<Self::Message>> {
fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
match message {
Message::Frame(now) => self.timeline.now(now),
Message::SetKbdBrightness(brightness) => {
@ -280,7 +256,7 @@ impl cosmic::Application for CosmicBatteryApplet {
}
return cosmic::iced::Task::perform(
tokio::time::sleep(Duration::from_millis(200)),
|_| cosmic::app::Message::App(Message::SetKbdBrightnessDebounced),
|_| cosmic::Action::App(Message::SetKbdBrightnessDebounced),
);
}
Message::SetScreenBrightnessDebounced => {
@ -295,7 +271,7 @@ impl cosmic::Application for CosmicBatteryApplet {
}
return cosmic::iced::Task::perform(
tokio::time::sleep(Duration::from_millis(200)),
|_| cosmic::app::Message::App(Message::SetScreenBrightnessDebounced),
|_| cosmic::Action::App(Message::SetScreenBrightnessDebounced),
);
}
Message::ReleaseKbdBrightness => {
@ -325,7 +301,7 @@ impl cosmic::Application for CosmicBatteryApplet {
if enable {
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 cosmic::{
app,
applet::token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
cctk::sctk::reexports::calloop,
surface_message::{MessageWrapper, SurfaceMessage},
surface,
};
use cosmic::{
@ -76,22 +77,7 @@ enum Message {
OpenSettings,
Frame(Instant),
ToggleBluetooth(chain::Toggler, bool),
Surface(SurfaceMessage),
}
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)
}
Surface(surface::Action),
}
impl cosmic::Application for CosmicBluetoothApplet {
@ -100,10 +86,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
type Flags = ();
const APP_ID: &'static str = config::APP_ID;
fn init(
core: cosmic::app::Core,
_flags: Self::Flags,
) -> (Self, iced::Task<cosmic::app::Message<Self::Message>>) {
fn init(core: cosmic::app::Core, _flags: Self::Flags) -> (Self, app::Task<Self::Message>) {
(
Self {
core,
@ -123,10 +106,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
&mut self.core
}
fn update(
&mut self,
message: Self::Message,
) -> iced::Task<cosmic::app::Message<Self::Message>> {
fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
match message {
Message::TogglePopup => {
if let Some(p) = self.popup.take() {
@ -153,7 +133,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
let _ = tx.send(BluerRequest::StateUpdate).await;
}
},
|_| cosmic::app::message::app(Message::Ignore),
|_| cosmic::action::app(Message::Ignore),
),
get_popup(popup_settings),
]);

View file

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

View file

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

View file

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

View file

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

View file

@ -18,8 +18,7 @@ use cosmic::{
window, Alignment, Length,
},
iced_runtime::core::layout::Limits,
surface_message::{MessageWrapper, SurfaceMessage},
theme,
surface, theme,
widget::{autosize, button, divider, icon, layer_container::layer_container, text, Space},
Element, Task,
};
@ -66,8 +65,8 @@ enum PowerAction {
}
impl PowerAction {
fn perform(self) -> iced::Task<cosmic::app::Message<Message>> {
let msg = |m| cosmic::app::message::app(Message::Zbus(m));
fn perform(self) -> iced::Task<cosmic::Action<Message>> {
let msg = |m| cosmic::action::app(Message::Zbus(m));
match self {
PowerAction::Lock => iced::Task::perform(lock(), 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)]
enum Message {
@ -99,7 +84,7 @@ enum Message {
Settings,
Zbus(Result<(), zbus::Error>),
Closed(window::Id),
Surface(SurfaceMessage),
Surface(surface::Action),
}
impl cosmic::Application for Power {

View file

@ -9,7 +9,7 @@ use cosmic::{
platform_specific::shell::commands::popup::{destroy_popup, get_popup},
window, Limits, Padding, Subscription,
},
surface_message::{MessageWrapper, SurfaceMessage},
surface,
widget::{container, mouse_area},
Element, Task,
};
@ -25,22 +25,7 @@ pub enum Msg {
StatusNotifier(status_notifier_watcher::Event),
TogglePopup(usize),
Hovered(usize),
Surface(SurfaceMessage),
}
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)
}
Surface(surface::Action),
}
#[derive(Default)]
@ -114,7 +99,7 @@ impl cosmic::Application for App {
Msg::StatusMenu((id, msg)) => match self.menus.get_mut(&id) {
Some(state) => state
.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(),
},
Msg::StatusNotifier(event) => match event {
@ -131,13 +116,13 @@ impl cosmic::Application for App {
{
*m = state;
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();
self.menus.insert(id, state);
app::Task::batch([
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) => {
@ -241,9 +226,13 @@ impl cosmic::Application for App {
popup_settings.positioner.anchor_rect.x = i as i32 * suggested_size as i32;
}
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 cosmic::{
app,
app::Core,
applet::{menu_button, padded_control},
cosmic_config::{Config, ConfigSet, CosmicConfigEntry},
@ -13,17 +14,16 @@ use cosmic::{
iced::{
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
window::Id,
Length, Limits, Subscription, Task,
Length, Limits, Subscription,
},
iced_widget::{column, row},
surface_message::{MessageWrapper, SurfaceMessage},
theme,
surface, theme,
widget::{
container, divider,
segmented_button::{self, Entity, SingleSelectModel},
segmented_control, text,
},
Element,
Element, Task,
};
use cosmic_comp_config::{CosmicCompConfig, TileBehavior};
use cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2::TilingState;
@ -61,22 +61,7 @@ pub enum Message {
WorkspaceUpdate(WorkspacesUpdate),
NewWorkspace(Entity),
OpenSettings,
Surface(SurfaceMessage),
}
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)
}
Surface(surface::Action),
}
impl cosmic::Application for Window {
@ -93,7 +78,7 @@ impl cosmic::Application for Window {
&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 =
Config::new("com.system76.CosmicComp", CosmicCompConfig::VERSION).unwrap();
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 {
Message::WorkspaceUpdate(msg) => match msg {
WorkspacesUpdate::State(state) => {

View file

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

View file

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

View file

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