Skip to content

Commit

Permalink
app: fix "stuck" notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
JerwuQu committed Oct 13, 2024
1 parent dfb9426 commit e25e30d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ggoled_app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ fn main() {
let tm_idle_check = CheckMenuItem::new("Screensaver when idle", true, config.idle_timeout, None);
let tm_oledshift_off = CheckMenuItem::new("Off", true, false, None);
let tm_oledshift_simple = CheckMenuItem::new("Simple", true, false, None);
// TODO: remove all these closures and create a struct instead
let update_oledshift = |dev: &mut DrawDevice, mode: ConfigShiftMode| {
tm_oledshift_off.set_checked(matches!(mode, ConfigShiftMode::Off));
tm_oledshift_simple.set_checked(matches!(mode, ConfigShiftMode::Simple));
Expand Down Expand Up @@ -222,6 +223,9 @@ fn main() {
DrawEvent::DeviceEvent(event) => match event {
ggoled_lib::DeviceEvent::HeadsetConnection { connected } => {
if config.show_notifications {
if let Some(id) = notif_layer {
dev.remove_layer(id);
}
notif_layer = Some(
dev.add_layer(ggoled_draw::DrawLayer::Image {
bitmap: (if connected {
Expand Down

0 comments on commit e25e30d

Please sign in to comment.