Skip to content

Commit

Permalink
fix: quite mode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Aug 14, 2024
1 parent 6c792ec commit b404f3a
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions lala_bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,14 +868,64 @@ impl MultiApplication for LalaMusicBar {
Message::QuiteMode(quite) => {
self.quite_mode = quite;
let mut commands = vec![];
for (id, _nid) in self.showned_notifications.iter() {
commands.push(Command::single(Action::Window(WindowAction::Close(*id))));
}
if let Some(extra_id) = self.hidenid {
commands.push(Command::single(Action::Window(WindowAction::Close(
extra_id,
))));
if quite {
for (id, _nid) in self.showned_notifications.iter() {
commands.push(Command::single(Action::Window(WindowAction::Close(*id))));
}
if let Some(extra_id) = self.hidenid {
commands.push(Command::single(Action::Window(WindowAction::Close(
extra_id,
))));
}
} else {
for (_, notify) in self
.notifications
.iter()
.filter(|(_, info)| info.counter < MAX_SHOWN_NOTIFICATIONS_COUNT)
{
commands.push(Command::single(
LaLaShellIdAction::new(
iced::window::Id::MAIN,
LalaShellAction::NewLayerShell((
NewLayerShellSettings {
size: Some((300, 130)),
exclusive_zone: None,
anchor: Anchor::Right | Anchor::Top,
layer: Layer::Top,
margin: Some((notify.upper, 10, 10, 10)),
keyboard_interactivity: KeyboardInteractivity::OnDemand,
use_last_output: true,
},
LaLaInfo::Notify(Box::new(notify.clone())),
)),
)
.into(),
));
}
if self.notifications.len() > MAX_SHOWN_NOTIFICATIONS_COUNT
&& self.hidenid.is_none()
{
commands.push(Command::single(
LaLaShellIdAction::new(
iced::window::Id::MAIN,
LalaShellAction::NewLayerShell((
NewLayerShellSettings {
size: Some((300, 25)),
exclusive_zone: None,
anchor: Anchor::Right | Anchor::Top,
layer: Layer::Top,
margin: Some((EXTRAINF_MARGIN, 10, 10, 10)),
keyboard_interactivity: KeyboardInteractivity::None,
use_last_output: true,
},
LaLaInfo::HiddenInfo,
)),
)
.into(),
));
}
}

return Command::batch(commands);
}

Expand Down

0 comments on commit b404f3a

Please sign in to comment.