mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
fix(launcher): favourites staying focused when closed in hyprland
Fixes #603
This commit is contained in:
parent
fd58ce771d
commit
9a39420ae2
1 changed files with 14 additions and 6 deletions
|
@ -182,13 +182,22 @@ impl Module<gtk::Box> for LauncherModule {
|
||||||
}?;
|
}?;
|
||||||
}
|
}
|
||||||
ToplevelEvent::Update(info) => {
|
ToplevelEvent::Update(info) => {
|
||||||
if let Some(item) = lock!(items).get_mut(&info.app_id) {
|
// check if open, as updates can be sent as program closes
|
||||||
|
// if it's a focused favourite closing, it otherwise incorrectly re-focuses.
|
||||||
|
let is_open = if let Some(item) = lock!(items).get_mut(&info.app_id) {
|
||||||
item.set_window_focused(info.id, info.focused);
|
item.set_window_focused(info.id, info.focused);
|
||||||
item.set_window_name(info.id, info.title.clone());
|
item.set_window_name(info.id, info.title.clone());
|
||||||
}
|
|
||||||
|
|
||||||
send_update(LauncherUpdate::Focus(info.app_id.clone(), info.focused))
|
item.open_state.is_open()
|
||||||
.await?;
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
send_update(LauncherUpdate::Focus(
|
||||||
|
info.app_id.clone(),
|
||||||
|
is_open && info.focused,
|
||||||
|
))
|
||||||
|
.await?;
|
||||||
send_update(LauncherUpdate::Title(
|
send_update(LauncherUpdate::Title(
|
||||||
info.app_id.clone(),
|
info.app_id.clone(),
|
||||||
info.id,
|
info.id,
|
||||||
|
@ -355,8 +364,7 @@ impl Module<gtk::Box> for LauncherModule {
|
||||||
button.set_open(true);
|
button.set_open(true);
|
||||||
button.set_focused(win.open_state.is_focused());
|
button.set_focused(win.open_state.is_focused());
|
||||||
|
|
||||||
let mut menu_state = write_lock!(button.menu_state);
|
write_lock!(button.menu_state).num_windows += 1;
|
||||||
menu_state.num_windows += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LauncherUpdate::RemoveItem(app_id) => {
|
LauncherUpdate::RemoveItem(app_id) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue