feat: allow hover drawers when border < 2

Closes #1297
This commit is contained in:
2 * r + 2 * t 2026-03-19 21:36:48 +11:00
parent 0548365a8c
commit 70d6225186
5 changed files with 17 additions and 13 deletions

View file

@ -3,4 +3,7 @@ import Quickshell.Io
JsonObject {
property int thickness: Appearance.padding.normal
property int rounding: Appearance.rounding.large
readonly property int minThickness: 2
readonly property int clampedThickness: Math.max(minThickness, thickness)
}

View file

@ -14,6 +14,7 @@ Item {
required property BarPopouts.Wrapper popouts
required property bool disabled
readonly property int clampedWidth: Math.max(Config.border.minThickness, implicitWidth)
readonly property int padding: Math.max(Appearance.padding.smaller, Config.border.thickness)
readonly property int contentWidth: Config.bar.sizes.innerWidth + padding * 2
readonly property int exclusiveZone: !disabled && (Config.bar.persistent || visibilities.bar) ? contentWidth : Config.border.thickness

View file

@ -50,7 +50,7 @@ CollapsibleSection {
label: qsTr("Border thickness")
value: rootPane.borderThickness
from: 0.1
from: 0
to: 100
decimals: 1
suffix: "px"

View file

@ -57,10 +57,10 @@ Variants {
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
mask: Region {
x: bar.implicitWidth + win.dragMaskPadding
y: Config.border.thickness + win.dragMaskPadding
width: win.width - bar.implicitWidth - Config.border.thickness - win.dragMaskPadding * 2
height: win.height - Config.border.thickness * 2 - win.dragMaskPadding * 2
x: bar.clampedWidth + win.dragMaskPadding
y: Config.border.clampedThickness + win.dragMaskPadding
width: win.width - bar.clampedWidth - Config.border.clampedThickness - win.dragMaskPadding * 2
height: win.height - Config.border.clampedThickness * 2 - win.dragMaskPadding * 2
intersection: Intersection.Xor
regions: regions.instances

View file

@ -33,15 +33,15 @@ CustomMouseArea {
}
function inRightPanel(panel: Item, x: real, y: real): bool {
return x > bar.implicitWidth + panel.x && withinPanelHeight(panel, x, y);
return x > Math.min(width - Config.border.minThickness, bar.implicitWidth + panel.x) && withinPanelHeight(panel, x, y);
}
function inTopPanel(panel: Item, x: real, y: real): bool {
return y < Config.border.thickness + panel.y + panel.height && withinPanelWidth(panel, x, y);
return y < Math.max(Config.border.minThickness, Config.border.thickness + panel.height) + panel.y && withinPanelWidth(panel, x, y);
}
function inBottomPanel(panel: Item, x: real, y: real): bool {
return y > root.height - Config.border.thickness - panel.height - Config.border.rounding && withinPanelWidth(panel, x, y);
function inBottomPanel(panel: Item, x: real, y: real, isCorner = false): bool {
return y > height - Math.max(Config.border.minThickness, Config.border.thickness + panel.height) - (isCorner ? Config.border.rounding : 0) && withinPanelWidth(panel, x, y);
}
function onWheel(event: WheelEvent): void {
@ -88,11 +88,11 @@ CustomMouseArea {
const dragY = y - dragStart.y;
// Show bar in non-exclusive mode on hover
if (!visibilities.bar && Config.bar.showOnHover && x < bar.implicitWidth)
if (!visibilities.bar && Config.bar.showOnHover && x < bar.clampedWidth)
bar.isHovered = true;
// Show/hide bar on drag
if (pressed && dragStart.x < bar.implicitWidth) {
if (pressed && dragStart.x < bar.clampedWidth) {
if (dragX > Config.bar.dragThreshold)
visibilities.bar = true;
else if (dragX < -Config.bar.dragThreshold)
@ -113,7 +113,7 @@ CustomMouseArea {
root.panels.osd.hovered = true;
}
const showSidebar = pressed && dragStart.x > bar.implicitWidth + panels.sidebar.x;
const showSidebar = pressed && dragStart.x > Math.min(width - Config.border.minThickness, bar.implicitWidth + panels.sidebar.x);
// Show/hide session on drag
if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) {
@ -188,7 +188,7 @@ CustomMouseArea {
}
// Show utilities on hover
const showUtilities = inBottomPanel(panels.utilities, x, y);
const showUtilities = inBottomPanel(panels.utilities, x, y, true);
// Always update visibility based on hover if not in shortcut mode
if (!utilitiesShortcutActive) {