Skip to content

Commit

Permalink
fix: only move windows down of launcher is active
Browse files Browse the repository at this point in the history
Signed-off-by: Enrico Stemmer <[email protected]>
  • Loading branch information
H3rmt committed Jan 16, 2025
1 parent 50af3e1 commit 689344f
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions src/daemon/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,25 @@ async fn handle_updates(
}
trace!("Rebuilding window {:?}", window);

let workspaces = data
.hypr_data
.workspaces
.iter()
.filter(|(_, w)| {
data.gui_config.show_workspaces_on_all_monitors
|| w.monitor == monitor_data.id
})
.collect::<Vec<_>>()
.len() as i32;
let rows = (workspaces as f32 / init_config.workspaces_per_row as f32)
.ceil() as i32;
let height = monitor.geometry().height();
window.set_margin(
gtk4_layer_shell::Edge::Bottom,
max(30, (height / 2) - ((height / 5) * rows)),
);
if data.gui_config.show_launcher {
let workspaces = data
.hypr_data
.workspaces
.iter()
.filter(|(_, w)| {
data.gui_config.show_workspaces_on_all_monitors
|| w.monitor == monitor_data.id
})
.collect::<Vec<_>>()
.len() as i32;
let rows = (workspaces as f32 / init_config.workspaces_per_row as f32)
.ceil() as i32;
let height = monitor.geometry().height();
window.set_margin(
gtk4_layer_shell::Edge::Bottom,
max(30, (height / 2) - ((height / 5) * rows)),
);
}

window.show();
windows::init_windows(
Expand Down Expand Up @@ -202,13 +204,16 @@ async fn handle_updates(
if data.launcher.selected.is_some() && e.text().is_empty() {
data.launcher.selected = None;
}
let selected = data.launcher.selected;
let reverse_key = match &data.submap_info {
Submap::Name((_, r)) => r,
Submap::Config(c) => &c.reverse_key,
};
let execs =
launcher::update_launcher(&e.text(), l, selected, reverse_key);
let execs = launcher::update_launcher(
&e.text(),
l,
data.launcher.selected,
reverse_key,
);
data.launcher.execs = execs;
});
}
Expand Down

0 comments on commit 689344f

Please sign in to comment.