Share pointer movement gate across menus

This commit is contained in:
David Heinemeier Hansson
2026-06-29 11:56:21 -05:00
parent a3f8c494e3
commit 472b5cd557
9 changed files with 163 additions and 43 deletions
+25 -2
View File
@@ -501,6 +501,7 @@ Item {
function select(delta) {
if (displayModel.count === 0) return
root.disarmPointer()
if (!cursorActive) {
cursorActive = true
selectedIndex = delta < 0 ? displayModel.count - 1 : 0
@@ -514,6 +515,7 @@ Item {
root.filterText = nextFilter
root.selectedIndex = 0
root.cursorActive = root.mode !== "input"
root.disarmPointer()
if (!root.dmenuActive && root.filterText.trim()) root.loadProvidersForSearch()
root.rebuildDisplay()
}
@@ -525,6 +527,7 @@ Item {
root.filterText = ""
root.selectedIndex = 0
root.cursorActive = true
root.disarmPointer()
root.rebuildDisplay()
root.loadProviderForMenu(id)
}
@@ -598,6 +601,7 @@ Item {
filterText = ""
selectedIndex = 0
cursorActive = true
root.disarmPointer()
root.evaluateGuards()
opened = true
rebuildDisplay()
@@ -621,6 +625,7 @@ Item {
filterText = ""
selectedIndex = 0
cursorActive = mode !== "input"
root.disarmPointer()
opened = true
rebuildDisplay()
@@ -667,6 +672,16 @@ Item {
return "ok"
}
function disarmPointer() {
pointerGate.reset()
}
function selectFromPointer(index, item, mouse) {
if (!pointerGate.moved(item, mouse)) return
root.cursorActive = true
root.selectedIndex = index
}
Process {
id: providerProc
property string menuId: ""
@@ -693,6 +708,11 @@ Item {
}
}
PointerMoveGate {
id: pointerGate
referenceItem: card
}
// The JSONC sources are watched so live edits to the default file (or the
// user extension at ~/.config/omarchy/extensions/omarchy-menu.jsonc) take
// effect without restarting the shell.
@@ -1020,11 +1040,14 @@ Item {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPositionChanged: {
onPositionChanged: function(mouse) {
root.selectFromPointer(row.index, row, mouse)
}
onClicked: {
root.cursorActive = true
root.selectedIndex = row.index
root.activateIndex(row.index)
}
onClicked: root.activateIndex(row.index)
}
}
}