mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 02:31:04 +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, _) => {
|
LauncherUpdate::AddWindow(app_id, _) => {
|
||||||
if let Some(button) = buttons.get(&app_id) {
|
if let Some(button) = buttons.get(&app_id) {
|
||||||
|
button.set_open(true);
|
||||||
|
|
||||||
let mut menu_state = button
|
let mut menu_state = button
|
||||||
.menu_state
|
.menu_state
|
||||||
.write()
|
.write()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
use tracing::trace;
|
||||||
use wayland_client::{DispatchData, Main};
|
use wayland_client::{DispatchData, Main};
|
||||||
use wayland_protocols::wlr::unstable::foreign_toplevel::v1::client::zwlr_foreign_toplevel_handle_v1::{Event, ZwlrForeignToplevelHandleV1};
|
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
|
where
|
||||||
F: FnMut(ToplevelEvent, DispatchData),
|
F: FnMut(ToplevelEvent, DispatchData),
|
||||||
{
|
{
|
||||||
|
trace!("event: {event:?} (info: {info:?})");
|
||||||
|
|
||||||
let change = match event {
|
let change = match event {
|
||||||
Event::AppId { app_id } => {
|
Event::AppId { app_id } => {
|
||||||
info.app_id = app_id;
|
info.app_id = app_id;
|
||||||
|
@ -98,13 +101,16 @@ where
|
||||||
|
|
||||||
change
|
change
|
||||||
}
|
}
|
||||||
Event::Closed => Some(ToplevelChange::Close),
|
Event::Closed => {
|
||||||
|
if info.ready {
|
||||||
|
Some(ToplevelChange::Close)
|
||||||
|
} else { None }
|
||||||
|
},
|
||||||
Event::OutputEnter { output: _ } => None,
|
Event::OutputEnter { output: _ } => None,
|
||||||
Event::OutputLeave { output: _ } => None,
|
Event::OutputLeave { output: _ } => None,
|
||||||
Event::Parent { parent: _ } => None,
|
Event::Parent { parent: _ } => None,
|
||||||
Event::Done => {
|
Event::Done => {
|
||||||
assert_ne!(info.app_id, "");
|
if info.ready || info.app_id.is_empty() {
|
||||||
if info.ready {
|
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
info.ready = true;
|
info.ready = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue