diff --git a/Cargo.lock b/Cargo.lock index c737830..05d0e52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1853,15 +1853,16 @@ dependencies = [ [[package]] name = "iced_layershell" -version = "0.7.0-beta1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07e6a4645814ecc8ad2506f8b489ed5472ba28b3903006512b90f6bd74d5ec3" +checksum = "1f371f8ce2942df542270905c5e825f242bcae1bb9dec5cf88211eb559654b1f" dependencies = [ "futures", "iced", "iced_core", "iced_futures", "iced_graphics", + "iced_layershell_macros", "iced_renderer", "iced_runtime", "layershellev", @@ -1871,6 +1872,17 @@ dependencies = [ "window_clipboard", ] +[[package]] +name = "iced_layershell_macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d4a0eeab61c0ec4c7e87883fc89fe0b797aa1941da30e8925ebe12e01da6923" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "iced_renderer" version = "0.13.0" @@ -1972,7 +1984,7 @@ dependencies = [ [[package]] name = "iced_zbus_notification" -version = "0.3.16" +version = "0.4.0" dependencies = [ "async-trait", "futures", @@ -2139,7 +2151,7 @@ dependencies = [ [[package]] name = "lala-bar" -version = "0.3.16" +version = "0.4.0" dependencies = [ "alsa", "anyhow", @@ -2166,9 +2178,9 @@ dependencies = [ [[package]] name = "layershellev" -version = "0.7.0-beta1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5455f239975bad4ad356129ebe51ca5d3803b82f724ba71ea8753817bbf4b2a0" +checksum = "413fc578a0f06874c6bd9bf05a971397036266ee5441f6723e8b2b6b9f619eff" dependencies = [ "bitflags 2.6.0", "log", @@ -4213,9 +4225,9 @@ dependencies = [ [[package]] name = "waycrate_xkbkeycode" -version = "0.7.0-beta1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99785b3520e668e4cca4733d7d596b57192edfdb38b0dfcf8f67f02c8db2bc57" +checksum = "b28bc4368a57ca2f6086a3e0bdcb9328f239e3fe28fbafe5c14aeb0ad1b56e17" dependencies = [ "bitflags 2.6.0", "log", diff --git a/Cargo.toml b/Cargo.toml index ff38bf7..450c14f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["./lala_bar", "./iced_zbus_notification"] [workspace.package] -version = "0.3.16" +version = "0.4.0" edition = "2021" authors = ["Decodertalkers "] license = "MIT" @@ -11,7 +11,7 @@ repository = "https://github.com/Decodetalkers/lala-bar" readme = "README.md" [workspace.dependencies] -iced_zbus_notification = { version = "0.3.14", path = "iced_zbus_notification" } +iced_zbus_notification = { version = "0.4.0", path = "iced_zbus_notification" } futures = "0.3.30" serde = { version = "1.0.210", features = ["derive"] } url = "2.5.2" diff --git a/lala_bar/Cargo.toml b/lala_bar/Cargo.toml index 0571c03..1e5281e 100644 --- a/lala_bar/Cargo.toml +++ b/lala_bar/Cargo.toml @@ -20,7 +20,7 @@ iced = { version = "0.13.1", features = [ "svg", ] } iced_runtime = "0.13.0" -iced_layershell = "0.7.0-beta1" +iced_layershell = "0.7.1" tokio = { version = "1.40", features = ["full"] } iced_futures = "0.13.1" env_logger = "0.11.5" diff --git a/lala_bar/src/main.rs b/lala_bar/src/main.rs index 8e1dc94..65e0f68 100644 --- a/lala_bar/src/main.rs +++ b/lala_bar/src/main.rs @@ -9,9 +9,6 @@ use iced::widget::{ }; use iced::{executor, Alignment, Font}; use iced::{Element, Length, Task as Command, Theme}; -use iced_layershell::actions::{ - LayershellCustomActionsWithIdAndInfo, LayershellCustomActionsWithInfo, -}; use iced_zbus_notification::{ start_connection, ImageInfo, LaLaMako, MessageSender, NotifyMessage, NotifyUnit, VersionInfo, DEFAULT_ACTION, NOTIFICATION_SERVICE_PATH, @@ -22,6 +19,7 @@ use zbus_mpirs::ServiceInfo; use chrono::prelude::*; use iced_layershell::reexport::{Anchor, KeyboardInteractivity, Layer, NewLayerShellSettings}; use iced_layershell::settings::{LayerShellSettings, Settings}; +use iced_layershell::to_layer_message; use iced_layershell::MultiApplication; use iced_runtime::window::Action as WindowAction; use iced_runtime::Action; @@ -34,9 +32,6 @@ mod aximer; mod launcher; mod zbus_mpirs; -type LaLaShellIdAction = LayershellCustomActionsWithIdAndInfo; -type LalaShellAction = LayershellCustomActionsWithInfo; - const BEGINNING_UP_MARGIN: i32 = 10; const UNIT_MARGIN: i32 = 135; @@ -533,7 +528,7 @@ impl LalaMusicBar { } } -#[derive(Debug, Clone)] +#[to_layer_message(multi, info_name = "LaLaInfo", derives = "Debug Clone")] enum Message { RequestPre, RequestNext, @@ -560,38 +555,6 @@ enum Message { QuiteMode(bool), CloseErrorNotification(iced::window::Id), Ready(Sender), - - // LayerShellInfo - NewLayerShell { - info: LaLaInfo, - settings: NewLayerShellSettings, - }, - ForgetLastOutput, - MarginChange { - id: iced::window::Id, - margin: (i32, i32, i32, i32), - }, -} - -impl TryInto for Message { - type Error = Self; - fn try_into(self) -> Result { - match self { - Self::NewLayerShell { info, settings } => Ok(LaLaShellIdAction::new( - None, - LalaShellAction::NewLayerShell((settings, info)), - )), - Self::ForgetLastOutput => Ok(LaLaShellIdAction::new( - None, - LalaShellAction::ForgetLastOutput, - )), - Self::MarginChange { id, margin } => Ok(LaLaShellIdAction::new( - Some(id), - LalaShellAction::MarginChange(margin), - )), - _ => Err(self), - } - } } impl From for Message {