From 7e88e904bab7a9db2d01b5a1e4296c49bb35be93 Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Sat, 10 Aug 2024 23:43:45 +0859 Subject: [PATCH] feat: better inline reply --- lala_bar/src/main.rs | 25 ++++++++++++++++--------- notification_iced/src/lib.rs | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lala_bar/src/main.rs b/lala_bar/src/main.rs index 1eba72f..f2de210 100644 --- a/lala_bar/src/main.rs +++ b/lala_bar/src/main.rs @@ -361,7 +361,7 @@ impl LalaMusicBar { for (_, unit) in self.notifications.iter_mut() { if unit.counter > counter { unit.counter -= 1; - unit.upper -= 75; + unit.upper -= 135; } } } @@ -554,7 +554,7 @@ impl MultiApplication for LalaMusicBar { Message::Notify(NotifyMessage::UnitAdd(notify)) => { let mut commands = vec![]; for (id, unit) in self.notifications.iter_mut() { - unit.upper += 75; + unit.upper += 135; commands.push(Command::single( LaLaShellIdAction::new( *id, @@ -569,7 +569,7 @@ impl MultiApplication for LalaMusicBar { iced::window::Id::MAIN, LalaShellAction::NewLayerShell(( NewLayerShellSettings { - size: Some((300, 70)), + size: Some((300, 130)), exclusive_zone: None, anchor: Anchor::Right | Anchor::Top, layer: Layer::Top, @@ -637,7 +637,7 @@ impl MultiApplication for LalaMusicBar { let mut commands = vec![]; for (id, unit) in self.notifications.iter_mut() { if unit.upper > removed_pos { - unit.upper -= 75; + unit.upper -= 135; } commands.push(Command::single( LaLaShellIdAction::new( @@ -693,7 +693,7 @@ impl MultiApplication for LalaMusicBar { let mut commands = vec![]; for (id, unit) in self.notifications.iter_mut() { if unit.upper > removed_pos { - unit.upper -= 75; + unit.upper -= 135; } commands.push(Command::single( LaLaShellIdAction::new( @@ -727,7 +727,7 @@ impl MultiApplication for LalaMusicBar { } } LaLaInfo::Notify(notify) => { - let btnwidgets: Element = button(row![ + let btnwidgets: Element = button(column![ text(notify.summery.clone()).shaping(text::Shaping::Advanced), text(notify.body.clone()).shaping(text::Shaping::Advanced) ]) @@ -741,9 +741,16 @@ impl MultiApplication for LalaMusicBar { btnwidgets, Space::with_height(5.), row![ - text_input("reply something", ¬ifywidget.inline_reply).on_input( - move |msg| Message::InlineReplyMsgUpdate((id.clone(), msg)) - ), + text_input("reply something", ¬ifywidget.inline_reply) + .on_input(move |msg| Message::InlineReplyMsgUpdate(( + id.clone(), + msg + ))) + .on_submit(Message::InlineReply(( + id, + notify.id, + notifywidget.inline_reply.clone() + ))), button("send").on_press(Message::InlineReply(( id, notify.id, diff --git a/notification_iced/src/lib.rs b/notification_iced/src/lib.rs index ffbb258..68064ec 100644 --- a/notification_iced/src/lib.rs +++ b/notification_iced/src/lib.rs @@ -125,7 +125,7 @@ impl + Send + 'static> LaLaMako { summery: &str, body: &str, actions: Vec<&str>, - mut hints: std::collections::HashMap<&str, OwnedValue>, + _hints: std::collections::HashMap<&str, OwnedValue>, timeout: i32, ) -> zbus::fdo::Result { self.sender