1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-12 23:32:50 -04:00

Refactor(DankBar): Restore previous autohide logic & add autoHideStrict setting

This commit is contained in:
purian23
2026-05-10 21:14:09 -04:00
parent 1ec0311086
commit 4193cf51ff
5 changed files with 72 additions and 5 deletions
+1
View File
@@ -759,6 +759,7 @@ Singleton {
"fontScale": 1.0, "fontScale": 1.0,
"iconScale": 1.0, "iconScale": 1.0,
"autoHide": false, "autoHide": false,
"autoHideStrict": false,
"autoHideDelay": 250, "autoHideDelay": 250,
"showOnWindowsOpen": false, "showOnWindowsOpen": false,
"openOnOverview": false, "openOnOverview": false,
@@ -484,6 +484,7 @@ var SPEC = {
fontScale: 1.0, fontScale: 1.0,
iconScale: 1.0, iconScale: 1.0,
autoHide: false, autoHide: false,
autoHideStrict: false,
autoHideDelay: 250, autoHideDelay: 250,
showOnWindowsOpen: false, showOnWindowsOpen: false,
openOnOverview: false, openOnOverview: false,
+54 -5
View File
@@ -817,11 +817,51 @@ PanelWindow {
interval: barWindow.clickThroughEnabled ? Math.max((barConfig?.autoHideDelay ?? 250) * 6, 1500) : (barConfig?.autoHideDelay ?? 250) interval: barWindow.clickThroughEnabled ? Math.max((barConfig?.autoHideDelay ?? 250) * 6, 1500) : (barConfig?.autoHideDelay ?? 250)
repeat: false repeat: false
onTriggered: { onTriggered: {
if (!topBarMouseArea.containsMouse) if (!topBarMouseArea.containsMouse && !topBarCore.popoutPinsReveal)
topBarCore.revealSticky = false; topBarCore.revealSticky = false;
} }
} }
property bool hasActivePopout: false
readonly property bool popoutPinsReveal: !!(hasActivePopout && !(barConfig?.autoHideStrict ?? false))
onHasActivePopoutChanged: evaluateReveal()
onPopoutPinsRevealChanged: 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();
}
function onPopoutOpening() {
topBarCore.evaluateReveal();
}
}
Connections {
target: TrayMenuManager
function onActiveTrayMenusChanged() {
topBarCore.updateActivePopoutState();
}
}
property bool reveal: { property bool reveal: {
if (barWindow.hasFullscreenToplevel) if (barWindow.hasFullscreenToplevel)
return false; return false;
@@ -833,24 +873,27 @@ PanelWindow {
const showOnWindowsSetting = barConfig?.showOnWindowsOpen ?? false; const showOnWindowsSetting = barConfig?.showOnWindowsOpen ?? false;
if (showOnWindowsSetting && autoHide && (CompositorService.isNiri || CompositorService.isHyprland)) { if (showOnWindowsSetting && autoHide && (CompositorService.isNiri || CompositorService.isHyprland)) {
if (barWindow.shouldHideForWindows) if (barWindow.shouldHideForWindows)
return topBarMouseArea.containsMouse || revealSticky || ipcReveal; return topBarMouseArea.containsMouse || popoutPinsReveal || revealSticky || ipcReveal;
return true; return true;
} }
if (CompositorService.isNiri && NiriService.inOverview) if (CompositorService.isNiri && NiriService.inOverview)
return topBarMouseArea.containsMouse || revealSticky || ipcReveal; return topBarMouseArea.containsMouse || popoutPinsReveal || revealSticky || ipcReveal;
return (barConfig?.visible ?? true) && (!autoHide || topBarMouseArea.containsMouse || revealSticky || ipcReveal); return (barConfig?.visible ?? true) && (!autoHide || topBarMouseArea.containsMouse || popoutPinsReveal || revealSticky || ipcReveal);
} }
Connections { Connections {
function onBarConfigChanged() { function onBarConfigChanged() {
topBarCore.autoHide = barConfig?.autoHide ?? false; topBarCore.autoHide = barConfig?.autoHide ?? false;
topBarCore.evaluateReveal();
} }
target: rootWindow target: rootWindow
} }
Component.onCompleted: topBarCore.updateActivePopoutState()
function evaluateReveal() { function evaluateReveal() {
if (!autoHide) if (!autoHide)
return; return;
@@ -862,6 +905,12 @@ PanelWindow {
return; return;
} }
if (popoutPinsReveal) {
revealSticky = true;
revealHold.stop();
return;
}
revealHold.restart(); revealHold.restart();
} }
@@ -885,7 +934,7 @@ PanelWindow {
bottom: barWindow.isVertical ? parent.bottom : undefined bottom: barWindow.isVertical ? parent.bottom : undefined
} }
readonly property bool inOverview: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview readonly property bool inOverview: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview
hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel && !topBarCore.popoutPinsReveal
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
enabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel enabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel
@@ -129,6 +129,7 @@ Item {
fontScale: defaultBar.fontScale ?? 1.0, fontScale: defaultBar.fontScale ?? 1.0,
iconScale: defaultBar.iconScale ?? 1.0, iconScale: defaultBar.iconScale ?? 1.0,
autoHide: defaultBar.autoHide ?? false, autoHide: defaultBar.autoHide ?? false,
autoHideStrict: defaultBar.autoHideStrict ?? false,
autoHideDelay: defaultBar.autoHideDelay ?? 250, autoHideDelay: defaultBar.autoHideDelay ?? 250,
showOnWindowsOpen: defaultBar.showOnWindowsOpen ?? false, showOnWindowsOpen: defaultBar.showOnWindowsOpen ?? false,
openOnOverview: defaultBar.openOnOverview ?? false, openOnOverview: defaultBar.openOnOverview ?? false,
@@ -641,6 +642,18 @@ Item {
} }
} }
SettingsToggleRow {
width: parent.width - parent.leftPadding
text: I18n.tr("Strict auto-hide", "Dank bar setting: hide the bar when the pointer leaves even if a menu or bar popover is still open")
checked: selectedBarConfig?.autoHideStrict ?? false
onToggled: toggled => {
SettingsData.updateBarConfig(selectedBarId, {
autoHideStrict: toggled
});
notifyHorizontalBarChange();
}
}
SettingsToggleRow { SettingsToggleRow {
width: parent.width - parent.leftPadding width: parent.width - parent.leftPadding
visible: CompositorService.isNiri || CompositorService.isHyprland visible: CompositorService.isNiri || CompositorService.isHyprland
@@ -933,9 +933,12 @@
"dank", "dank",
"hidden", "hidden",
"hide", "hide",
"menu",
"panel", "panel",
"popover",
"show", "show",
"statusbar", "statusbar",
"strict",
"topbar", "topbar",
"visibility", "visibility",
"visible" "visible"