mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-10 22:39:37 -04:00
Refactor(DankBar): Restore previous autohide logic & add autoHideStrict setting
This commit is contained in:
@@ -759,6 +759,7 @@ Singleton {
|
||||
"fontScale": 1.0,
|
||||
"iconScale": 1.0,
|
||||
"autoHide": false,
|
||||
"autoHideStrict": false,
|
||||
"autoHideDelay": 250,
|
||||
"showOnWindowsOpen": false,
|
||||
"openOnOverview": false,
|
||||
|
||||
@@ -484,6 +484,7 @@ var SPEC = {
|
||||
fontScale: 1.0,
|
||||
iconScale: 1.0,
|
||||
autoHide: false,
|
||||
autoHideStrict: false,
|
||||
autoHideDelay: 250,
|
||||
showOnWindowsOpen: false,
|
||||
openOnOverview: false,
|
||||
|
||||
@@ -817,11 +817,51 @@ PanelWindow {
|
||||
interval: barWindow.clickThroughEnabled ? Math.max((barConfig?.autoHideDelay ?? 250) * 6, 1500) : (barConfig?.autoHideDelay ?? 250)
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (!topBarMouseArea.containsMouse)
|
||||
if (!topBarMouseArea.containsMouse && !topBarCore.popoutPinsReveal)
|
||||
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: {
|
||||
if (barWindow.hasFullscreenToplevel)
|
||||
return false;
|
||||
@@ -833,24 +873,27 @@ PanelWindow {
|
||||
const showOnWindowsSetting = barConfig?.showOnWindowsOpen ?? false;
|
||||
if (showOnWindowsSetting && autoHide && (CompositorService.isNiri || CompositorService.isHyprland)) {
|
||||
if (barWindow.shouldHideForWindows)
|
||||
return topBarMouseArea.containsMouse || revealSticky || ipcReveal;
|
||||
return topBarMouseArea.containsMouse || popoutPinsReveal || revealSticky || ipcReveal;
|
||||
return true;
|
||||
}
|
||||
|
||||
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 {
|
||||
function onBarConfigChanged() {
|
||||
topBarCore.autoHide = barConfig?.autoHide ?? false;
|
||||
topBarCore.evaluateReveal();
|
||||
}
|
||||
|
||||
target: rootWindow
|
||||
}
|
||||
|
||||
Component.onCompleted: topBarCore.updateActivePopoutState()
|
||||
|
||||
function evaluateReveal() {
|
||||
if (!autoHide)
|
||||
return;
|
||||
@@ -862,6 +905,12 @@ PanelWindow {
|
||||
return;
|
||||
}
|
||||
|
||||
if (popoutPinsReveal) {
|
||||
revealSticky = true;
|
||||
revealHold.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
revealHold.restart();
|
||||
}
|
||||
|
||||
@@ -885,7 +934,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
|
||||
hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel && !topBarCore.popoutPinsReveal
|
||||
acceptedButtons: Qt.NoButton
|
||||
enabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ Item {
|
||||
fontScale: defaultBar.fontScale ?? 1.0,
|
||||
iconScale: defaultBar.iconScale ?? 1.0,
|
||||
autoHide: defaultBar.autoHide ?? false,
|
||||
autoHideStrict: defaultBar.autoHideStrict ?? false,
|
||||
autoHideDelay: defaultBar.autoHideDelay ?? 250,
|
||||
showOnWindowsOpen: defaultBar.showOnWindowsOpen ?? 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 {
|
||||
width: parent.width - parent.leftPadding
|
||||
visible: CompositorService.isNiri || CompositorService.isHyprland
|
||||
|
||||
@@ -933,9 +933,12 @@
|
||||
"dank",
|
||||
"hidden",
|
||||
"hide",
|
||||
"menu",
|
||||
"panel",
|
||||
"popover",
|
||||
"show",
|
||||
"statusbar",
|
||||
"strict",
|
||||
"topbar",
|
||||
"visibility",
|
||||
"visible"
|
||||
|
||||
Reference in New Issue
Block a user