1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-01 10:41:03 +02:00

Merge pull request #238 from JakeStanger/fix/launcher-focus

Launcher focus fixes
This commit is contained in:
Jake Stanger 2023-07-16 20:53:20 +01:00 committed by GitHub
commit c09bec2d2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,6 +165,7 @@ impl Module<gtk::Box> for LauncherModule {
match item {
None => {
let item: Item = handle.try_into()?;
items.insert(info.app_id.clone(), item.clone());
ItemOrWindow::Item(item)
@ -358,9 +359,10 @@ impl Module<gtk::Box> for LauncherModule {
buttons.insert(item.app_id, button);
}
}
LauncherUpdate::AddWindow(app_id, _) => {
LauncherUpdate::AddWindow(app_id, win) => {
if let Some(button) = buttons.get(&app_id) {
button.set_open(true);
button.set_focused(win.open_state.is_focused());
let mut menu_state = write_lock!(button.menu_state);
menu_state.num_windows += 1;
@ -381,8 +383,12 @@ impl Module<gtk::Box> for LauncherModule {
}
}
}
LauncherUpdate::RemoveWindow(app_id, _) => {
LauncherUpdate::RemoveWindow(app_id, win_id) => {
debug!("Removing window {win_id} with id {app_id}");
if let Some(button) = buttons.get(&app_id) {
button.set_focused(false);
let mut menu_state = write_lock!(button.menu_state);
menu_state.num_windows -= 1;
}