Skip to content

Commit

Permalink
feat: better inline reply
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Aug 10, 2024
1 parent 64b605b commit 7e88e90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions lala_bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -727,7 +727,7 @@ impl MultiApplication for LalaMusicBar {
}
}
LaLaInfo::Notify(notify) => {
let btnwidgets: Element<Message> = button(row![
let btnwidgets: Element<Message> = button(column![
text(notify.summery.clone()).shaping(text::Shaping::Advanced),
text(notify.body.clone()).shaping(text::Shaping::Advanced)
])
Expand All @@ -741,9 +741,16 @@ impl MultiApplication for LalaMusicBar {
btnwidgets,
Space::with_height(5.),
row![
text_input("reply something", &notifywidget.inline_reply).on_input(
move |msg| Message::InlineReplyMsgUpdate((id.clone(), msg))
),
text_input("reply something", &notifywidget.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,
Expand Down
2 changes: 1 addition & 1 deletion notification_iced/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl<T: From<NotifyMessage> + Send + 'static> LaLaMako<T> {
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<u32> {
self.sender
Expand Down

0 comments on commit 7e88e90

Please sign in to comment.