mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Dock: possible auto-hide fix
This commit is contained in:
+36
-9
@@ -150,9 +150,16 @@ Variants {
|
||||
id: hideTimer
|
||||
interval: hideDelay
|
||||
onTriggered: {
|
||||
// Force menuHovered to false if no menu is current or visible
|
||||
if (!root.currentContextMenu || !root.currentContextMenu.visible) {
|
||||
menuHovered = false
|
||||
}
|
||||
if (autoHide && !dockHovered && !anyAppHovered && !peekHovered && !menuHovered) {
|
||||
hidden = true
|
||||
unloadTimer.restart() // Start unload timer when hiding
|
||||
} else if (autoHide && !dockHovered && !peekHovered) {
|
||||
// Restart timer if menu is closing (handles race condition)
|
||||
restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,6 +233,7 @@ Variants {
|
||||
|
||||
// DOCK WINDOW
|
||||
Loader {
|
||||
id: dockWindowLoader
|
||||
active: Settings.data.dock.enabled && (barIsReady || !hasBar) && modelData && (Settings.data.dock.monitors.length === 0 || Settings.data.dock.monitors.includes(modelData.name)) && dockLoaded && ToplevelManager && (dockApps.length > 0)
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
@@ -434,24 +442,38 @@ Variants {
|
||||
// Context menu popup
|
||||
DockMenu {
|
||||
id: contextMenu
|
||||
onHoveredChanged: menuHovered = hovered
|
||||
onRequestClose: {
|
||||
contextMenu.hide()
|
||||
// Restart hide timer after menu action if auto-hide is enabled
|
||||
if (autoHide && !dockHovered && !anyAppHovered && !peekHovered) {
|
||||
hideTimer.restart()
|
||||
onHoveredChanged: {
|
||||
// Only update menuHovered if this menu is current and visible
|
||||
if (root.currentContextMenu === contextMenu && contextMenu.visible) {
|
||||
menuHovered = hovered
|
||||
} else {
|
||||
menuHovered = false
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: contextMenu
|
||||
function onRequestClose() {
|
||||
// Clear current menu immediately to prevent hover updates
|
||||
root.currentContextMenu = null
|
||||
hideTimer.stop()
|
||||
contextMenu.hide()
|
||||
menuHovered = false
|
||||
anyAppHovered = false
|
||||
}
|
||||
}
|
||||
onAppClosed: root.updateDockApps // Force immediate dock update when app is closed
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
root.currentContextMenu = contextMenu
|
||||
anyAppHovered = false
|
||||
} else if (root.currentContextMenu === contextMenu) {
|
||||
root.currentContextMenu = null
|
||||
// Reset menu hover state when menu becomes invisible
|
||||
hideTimer.stop()
|
||||
menuHovered = false
|
||||
// Restart hide timer if conditions are met
|
||||
if (autoHide && !dockHovered && !anyAppHovered && !peekHovered) {
|
||||
anyAppHovered = false
|
||||
// Restart hide timer after menu closes
|
||||
if (autoHide && !dockHovered && !anyAppHovered && !peekHovered && !menuHovered) {
|
||||
hideTimer.restart()
|
||||
}
|
||||
}
|
||||
@@ -460,6 +482,7 @@ Variants {
|
||||
|
||||
MouseArea {
|
||||
id: appMouseArea
|
||||
objectName: "appMouseArea"
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -482,6 +505,10 @@ Variants {
|
||||
onExited: {
|
||||
anyAppHovered = false
|
||||
TooltipService.hide()
|
||||
// Clear menuHovered if no current menu or menu not visible
|
||||
if (!root.currentContextMenu || !root.currentContextMenu.visible) {
|
||||
menuHovered = false
|
||||
}
|
||||
if (autoHide && !dockHovered && !peekHovered && !menuHovered) {
|
||||
hideTimer.restart()
|
||||
}
|
||||
|
||||
@@ -121,7 +121,6 @@ PopupWindow {
|
||||
|
||||
function show(item, toplevelData) {
|
||||
if (!item) {
|
||||
Logger.w("DockMenu", "anchorItem is undefined, won't show menu.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -175,8 +174,6 @@ PopupWindow {
|
||||
if (root.onAppClosed && typeof root.onAppClosed === "function") {
|
||||
Qt.callLater(root.onAppClosed)
|
||||
}
|
||||
} else {
|
||||
Logger.w("DockMenu", "Cannot close app - invalid toplevel reference")
|
||||
}
|
||||
root.hide()
|
||||
root.requestClose()
|
||||
|
||||
Reference in New Issue
Block a user