From c6a1473d2f8115b35072cd1fe477a19161b4a01e Mon Sep 17 00:00:00 2001 From: purian23 Date: Sat, 9 May 2026 23:48:33 -0400 Subject: [PATCH] refactor(DankBar): Update dbar autohide mode reveal logic --- quickshell/Modules/DankBar/DankBarWindow.qml | 54 ++++---------------- 1 file changed, 9 insertions(+), 45 deletions(-) diff --git a/quickshell/Modules/DankBar/DankBarWindow.qml b/quickshell/Modules/DankBar/DankBarWindow.qml index ab4599d4..eabb56bb 100644 --- a/quickshell/Modules/DankBar/DankBarWindow.qml +++ b/quickshell/Modules/DankBar/DankBarWindow.qml @@ -673,7 +673,9 @@ PanelWindow { anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left) anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right) - exclusiveZone: (barWindow.hasFullscreenToplevel || !(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (Theme.isConnectedEffect ? 0 : (barConfig?.bottomGap ?? 0))) + readonly property bool reserveExclusiveWhenAutoHidden: SettingsData.connectedFrameModeActive && !!barWindow.screen && SettingsData.isScreenInPreferences(barWindow.screen, SettingsData.frameScreenPreferences) + + exclusiveZone: (barWindow.hasFullscreenToplevel || !(barConfig?.visible ?? true) || (topBarCore.autoHide && !barWindow.reserveExclusiveWhenAutoHidden)) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (Theme.isConnectedEffect ? 0 : (barConfig?.bottomGap ?? 0))) Item { id: inputMask @@ -814,9 +816,8 @@ PanelWindow { interval: barWindow.clickThroughEnabled ? Math.max((barConfig?.autoHideDelay ?? 250) * 6, 1500) : (barConfig?.autoHideDelay ?? 250) repeat: false onTriggered: { - if (!topBarMouseArea.containsMouse && !topBarCore.hasActivePopout) { + if (!topBarMouseArea.containsMouse) topBarCore.revealSticky = false; - } } } @@ -831,44 +832,14 @@ PanelWindow { const showOnWindowsSetting = barConfig?.showOnWindowsOpen ?? false; if (showOnWindowsSetting && autoHide && (CompositorService.isNiri || CompositorService.isHyprland)) { if (barWindow.shouldHideForWindows) - return topBarMouseArea.containsMouse || hasActivePopout || revealSticky; + return topBarMouseArea.containsMouse || revealSticky; return true; } if (CompositorService.isNiri && NiriService.inOverview) - return topBarMouseArea.containsMouse || hasActivePopout || revealSticky; + return topBarMouseArea.containsMouse || revealSticky; - return (barConfig?.visible ?? true) && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout || revealSticky); - } - - property bool hasActivePopout: false - - onHasActivePopoutChanged: evaluateReveal() - - function updateActivePopoutState() { - if (!barWindow.screen) - return; - const screenName = barWindow.screen.name; - const activePopout = PopoutManager.currentPopoutsByScreen[screenName]; - const activeTrayMenu = TrayMenuManager.activeTrayMenus[screenName]; - const trayOpen = rootWindow.systemTrayMenuOpen; - - const hasVisiblePopout = activePopout && activePopout.shouldBeVisible; - topBarCore.hasActivePopout = !!(hasVisiblePopout || activeTrayMenu || trayOpen); - } - - Connections { - target: PopoutManager - function onPopoutChanged() { - topBarCore.updateActivePopoutState(); - } - } - - Connections { - target: TrayMenuManager - function onActiveTrayMenusChanged() { - topBarCore.updateActivePopoutState(); - } + return (barConfig?.visible ?? true) && (!autoHide || topBarMouseArea.containsMouse || revealSticky); } Connections { @@ -883,7 +854,7 @@ PanelWindow { if (!autoHide) return; - if (topBarMouseArea.containsMouse || hasActivePopout) { + if (topBarMouseArea.containsMouse) { revealSticky = true; revealHold.stop(); return; @@ -899,13 +870,6 @@ PanelWindow { } } - Connections { - target: PopoutManager - function onPopoutOpening() { - topBarCore.evaluateReveal(); - } - } - MouseArea { id: topBarMouseArea y: !barWindow.isVertical ? (barPos === SettingsData.Position.Bottom ? parent.height - height : 0) : 0 @@ -919,7 +883,7 @@ PanelWindow { bottom: barWindow.isVertical ? parent.bottom : undefined } readonly property bool inOverview: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview - hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel && !topBarCore.hasActivePopout + hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel acceptedButtons: Qt.NoButton enabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel