mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
fix: sometimes panicking on startup
This commit is contained in:
parent
75339f07ed
commit
b7b64886e3
2 changed files with 11 additions and 3 deletions
|
@ -352,6 +352,8 @@ impl Module<gtk::Box> for LauncherModule {
|
|||
}
|
||||
LauncherUpdate::AddWindow(app_id, _) => {
|
||||
if let Some(button) = buttons.get(&app_id) {
|
||||
button.set_open(true);
|
||||
|
||||
let mut menu_state = button
|
||||
.menu_state
|
||||
.write()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::HashSet;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use tracing::trace;
|
||||
use wayland_client::{DispatchData, Main};
|
||||
use wayland_protocols::wlr::unstable::foreign_toplevel::v1::client::zwlr_foreign_toplevel_handle_v1::{Event, ZwlrForeignToplevelHandleV1};
|
||||
|
||||
|
@ -54,6 +55,8 @@ fn toplevel_implem<F>(event: Event, info: &mut ToplevelInfo, implem: &mut F, dda
|
|||
where
|
||||
F: FnMut(ToplevelEvent, DispatchData),
|
||||
{
|
||||
trace!("event: {event:?} (info: {info:?})");
|
||||
|
||||
let change = match event {
|
||||
Event::AppId { app_id } => {
|
||||
info.app_id = app_id;
|
||||
|
@ -98,13 +101,16 @@ where
|
|||
|
||||
change
|
||||
}
|
||||
Event::Closed => Some(ToplevelChange::Close),
|
||||
Event::Closed => {
|
||||
if info.ready {
|
||||
Some(ToplevelChange::Close)
|
||||
} else { None }
|
||||
},
|
||||
Event::OutputEnter { output: _ } => None,
|
||||
Event::OutputLeave { output: _ } => None,
|
||||
Event::Parent { parent: _ } => None,
|
||||
Event::Done => {
|
||||
assert_ne!(info.app_id, "");
|
||||
if info.ready {
|
||||
if info.ready || info.app_id.is_empty() {
|
||||
None
|
||||
} else {
|
||||
info.ready = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue