Reserve the top of every monitor for the bar
edge::spacer: a full-width, empty, click-through Background layer as tall as the pills reach (TOP_GAP + COMPACT_H = 44 px) with Zone::Reserve. Hyprland keeps tiled and maximised windows below it and lets fullscreen windows cover it, so space is reserved exactly where the bar stays. Verified: reserved 0 44 0 0 on all monitors, a tiled window moved from y=636 to 680, a fullscreen one still covers 1920x1080, idle 0 frames.
This commit is contained in:
+19
@@ -410,3 +410,22 @@ pub fn view(monitor: &Monitor) -> LayerWindow {
|
||||
|
||||
window.child(Rectangle::new().width(Parent).height(Parent).on_hover(at_edge(monitor.name.clone())))
|
||||
}
|
||||
|
||||
/*
|
||||
* keeps windows out from under the bar: an empty strip as tall as the pills reach,
|
||||
* reserving its height on every monitor. Hyprland lets tiled and maximised windows
|
||||
* respect it and fullscreen ones cover it, which is just when the bar stays and when
|
||||
* it hides; it goes with the shell. the bar's own windows ignore what's reserved, so
|
||||
* they stay at the top edge. reads nothing, so it never redraws
|
||||
*/
|
||||
pub fn spacer(_: &Monitor) -> LayerWindow {
|
||||
LayerWindow::new()
|
||||
.width(Full)
|
||||
.height(TOP_GAP + COMPACT_H)
|
||||
.anchor_vertical(Vertical::Top)
|
||||
.layer(Layer::Background)
|
||||
.space(Zone::Reserve)
|
||||
.namespace("magic-reserve")
|
||||
.click_through()
|
||||
.child(Rectangle::new().width(0.0).height(0.0))
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ fn main() {
|
||||
.ipc("island", island::command)
|
||||
.ipc("control", control::command)
|
||||
.ipc("tray", tray::command)
|
||||
.window_per_monitor(edge::spacer)
|
||||
.window_per_monitor(edge::view)
|
||||
.window_per_monitor(island::view)
|
||||
.window_per_monitor(workspaces::view)
|
||||
|
||||
Reference in New Issue
Block a user