Skip to content

Commit

Permalink
chore: base fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Aug 11, 2024
1 parent a45f122 commit eed2981
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions lala_bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,18 +630,25 @@ impl MultiApplication for LalaMusicBar {
.map(|(id, _)| Command::single(Action::Window(WindowAction::Close(*id))))
.collect();

let mut removed_counters = vec![];
for id in removed_ids.iter() {
if let Some(NotifyUnitWidgetInfo { counter, .. }) =
self.notifications.remove(id)
{
for (_, unit) in self.notifications.iter_mut() {
if unit.counter > counter {
unit.counter -= 1;
unit.upper -= 135;
}
removed_counters.push(counter);
}
}
removed_counters.sort();
removed_counters.reverse();
for counter in removed_counters {
for (_, unit) in self.notifications.iter_mut() {
if unit.counter > counter {
unit.counter -= 1;
unit.upper -= 135;
}
}
}

for (id, unit) in self.notifications.iter() {
commands.push(Command::single(
LaLaShellIdAction::new(
Expand All @@ -663,14 +670,20 @@ impl MultiApplication for LalaMusicBar {
)
.map(|NotifyUnitWidgetInfo { counter, .. }| *counter)
.collect();

if self.notifications.len() < 3 {
for index in 0..self.notifications.len() {
remove_hided_notifications_count.push(index);
}
}
remove_hided_notifications_count.sort();
remove_hided_notifications_count.reverse();

self.hidden_notifications.retain(
|NotifyUnitWidgetInfo {
unit: NotifyUnit { id, .. },
..
}| *id == removed_id,
}| *id != removed_id,
);

for count in remove_hided_notifications_count {
Expand Down

0 comments on commit eed2981

Please sign in to comment.