mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat(bar): use reserve_space for both normnal bar and auto_hide
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@ Bars are defined as named subtables under `[bar.*]`. Each bar is spawned on ever
|
||||
position = "top" # top | bottom | left | right
|
||||
enabled = true
|
||||
auto_hide = false # slide out after pointer leaves; reveal from edge trigger strip
|
||||
reserve_space = false # keep exclusive zone even when auto-hidden
|
||||
reserve_space = true # reserve compositor exclusive zone / push windows away
|
||||
|
||||
thickness = 34 # bar cross-axis size in pixels (height for horizontal, width for vertical)
|
||||
background_opacity = 1.0 # 0.0 (transparent) to 1.0 (opaque)
|
||||
@@ -79,11 +79,11 @@ Only the fields you specify are overridden; everything else falls through to the
|
||||
## Auto-hide
|
||||
|
||||
When `auto_hide = true`, the bar:
|
||||
- Does **not** reserve compositor exclusive zone (windows are not pushed away).
|
||||
- Slides out once the pointer leaves the bar.
|
||||
- Slides back in when the pointer reaches the matching screen edge trigger strip.
|
||||
|
||||
Set `reserve_space = true` to keep the exclusive zone while auto-hidden.
|
||||
`reserve_space = true` reserves compositor exclusive zone and pushes windows away. Set it to `false` for overlay
|
||||
behavior. This applies whether `auto_hide` is enabled or disabled.
|
||||
|
||||
---
|
||||
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ shadow_blur = 12
|
||||
shadow_offset_x = 0
|
||||
shadow_offset_y = 6
|
||||
auto_hide = false
|
||||
reserve_space = false
|
||||
reserve_space = true
|
||||
capsule = false
|
||||
# capsule_fill = "surface_variant"
|
||||
# capsule_opacity = 1.0
|
||||
|
||||
@@ -58,8 +58,8 @@ struct BarConfig {
|
||||
std::string name = "default";
|
||||
std::string position = "top";
|
||||
bool enabled = true;
|
||||
bool autoHide = false; // slide out when the pointer leaves; reveal on edge approach
|
||||
bool reserveSpace = false; // keep compositor exclusive zone even while auto-hidden
|
||||
bool autoHide = false; // slide out when the pointer leaves; reveal on edge approach
|
||||
bool reserveSpace = true; // reserve compositor exclusive zone for this bar
|
||||
std::int32_t thickness = Style::barThicknessDefault;
|
||||
float backgroundOpacity = 1.0f;
|
||||
std::int32_t radius = Style::radiusXl;
|
||||
|
||||
@@ -596,7 +596,7 @@ void Bar::createInstance(const WaylandOutput& output, const BarConfig& barConfig
|
||||
const std::int32_t mH = barConfig.marginH;
|
||||
const std::int32_t mV = barConfig.marginV;
|
||||
const auto sb = computeShadowBleed(barConfig);
|
||||
const bool hiddenOverlayMode = barConfig.autoHide && !barConfig.reserveSpace;
|
||||
const bool reserveExclusiveZone = barConfig.reserveSpace;
|
||||
|
||||
// Compositor margins absorb the visual gap where the shadow doesn't reach.
|
||||
// The surface is sized to cover only the bar rect plus its shadow footprint.
|
||||
@@ -610,11 +610,11 @@ void Bar::createInstance(const WaylandOutput& output, const BarConfig& barConfig
|
||||
if (isBottom) {
|
||||
mBottom = std::max(0, mV - sb.down);
|
||||
surfH = static_cast<std::uint32_t>(sb.up + barConfig.thickness + std::min(mV, sb.down));
|
||||
exclusiveZone = hiddenOverlayMode ? 0 : (barConfig.thickness + std::min(mV, sb.down));
|
||||
exclusiveZone = reserveExclusiveZone ? (barConfig.thickness + std::min(mV, sb.down)) : 0;
|
||||
} else {
|
||||
mTop = std::max(0, mV - sb.up);
|
||||
surfH = static_cast<std::uint32_t>(std::min(mV, sb.up) + barConfig.thickness + sb.down);
|
||||
exclusiveZone = hiddenOverlayMode ? 0 : (std::min(mV, sb.up) + barConfig.thickness);
|
||||
exclusiveZone = reserveExclusiveZone ? (std::min(mV, sb.up) + barConfig.thickness) : 0;
|
||||
}
|
||||
} else {
|
||||
mTop = std::max(0, mV - sb.up);
|
||||
@@ -622,11 +622,11 @@ void Bar::createInstance(const WaylandOutput& output, const BarConfig& barConfig
|
||||
if (isRight) {
|
||||
mRight = std::max(0, mH - sb.right);
|
||||
surfW = static_cast<std::uint32_t>(sb.left + barConfig.thickness + std::min(mH, sb.right));
|
||||
exclusiveZone = hiddenOverlayMode ? 0 : (barConfig.thickness + std::min(mH, sb.right));
|
||||
exclusiveZone = reserveExclusiveZone ? (barConfig.thickness + std::min(mH, sb.right)) : 0;
|
||||
} else {
|
||||
mLeft = std::max(0, mH - sb.left);
|
||||
surfW = static_cast<std::uint32_t>(std::min(mH, sb.left) + barConfig.thickness + sb.right);
|
||||
exclusiveZone = hiddenOverlayMode ? 0 : (std::min(mH, sb.left) + barConfig.thickness);
|
||||
exclusiveZone = reserveExclusiveZone ? (std::min(mH, sb.left) + barConfig.thickness) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user