Fix preview callback closing picker during rebuild
This commit is contained in:
+5
-42
@@ -14,10 +14,6 @@ import "Classify.js" as Classify
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Injected by the Omarchy plugin host. Following its shared panel-open state
|
|
||||||
// keeps the mapped window and the host's callable Loader in sync even after
|
|
||||||
// plugin rescans temporarily leave more than one Loader instance alive.
|
|
||||||
property var shell: null
|
|
||||||
property bool opened: false
|
property bool opened: false
|
||||||
property string filterText: ""
|
property string filterText: ""
|
||||||
property string typeFilter: "" // chip filter, "" = all; combined into the query
|
property string typeFilter: "" // chip filter, "" = all; combined into the query
|
||||||
@@ -65,13 +61,7 @@ Item {
|
|||||||
// ------------------------------------------------------------ lifecycle
|
// ------------------------------------------------------------ lifecycle
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
// Keep the layer mapped and switch its content/input on explicitly.
|
|
||||||
// A visibility binding across the host Loader -> PanelWindow boundary can
|
|
||||||
// remain stale after plugin reloads on current Quickshell.
|
|
||||||
root.opened = true
|
root.opened = true
|
||||||
card.visible = true
|
|
||||||
panelInputRegion.width = panel.width
|
|
||||||
panelInputRegion.height = panel.height
|
|
||||||
root.depsChecked = false
|
root.depsChecked = false
|
||||||
root.checkDeps()
|
root.checkDeps()
|
||||||
root.filterText = ""
|
root.filterText = ""
|
||||||
@@ -85,9 +75,6 @@ Item {
|
|||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
root.cancelClearHistory()
|
root.cancelClearHistory()
|
||||||
card.visible = false
|
|
||||||
panelInputRegion.width = 0
|
|
||||||
panelInputRegion.height = 0
|
|
||||||
root.opened = false
|
root.opened = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,22 +83,7 @@ Item {
|
|||||||
else root.open()
|
else root.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncShellOpenState() {
|
// Direct target for explicit bindings and pause/resume automation.
|
||||||
if (!root.shell || !root.shell.openPanelIds) return
|
|
||||||
var shouldOpen = root.shell.openPanelIds["alanfortlink.clipboard"] === true
|
|
||||||
if (shouldOpen && !root.opened) root.open()
|
|
||||||
else if (!shouldOpen && root.opened) root.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
onShellChanged: root.syncShellOpenState()
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.shell
|
|
||||||
function onOpenPanelIdsChanged() { root.syncShellOpenState() }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Direct IPC avoids the host panel Loader selecting a stale instance after
|
|
||||||
// plugin rescans. Keybindings should target this handler, not shell.toggle.
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "alanfortlink.clipboard"
|
target: "alanfortlink.clipboard"
|
||||||
function open(): void { root.open() }
|
function open(): void { root.open() }
|
||||||
@@ -526,29 +498,20 @@ Item {
|
|||||||
|
|
||||||
// ------------------------------------------------------------ window
|
// ------------------------------------------------------------ window
|
||||||
|
|
||||||
// Keep the small floating layer mapped: current Quickshell can fail to
|
// Small floating card — no fullscreen surface or scrim.
|
||||||
// remap an unanchored PanelWindow after visible changes from false to true.
|
|
||||||
// While closed the card is invisible, keyboard focus is disabled, and the
|
|
||||||
// empty input region makes the surface completely click-through.
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: panel
|
id: panel
|
||||||
visible: true
|
visible: root.opened
|
||||||
implicitWidth: root.cardWidth
|
implicitWidth: root.cardWidth
|
||||||
implicitHeight: root.cardHeight
|
implicitHeight: root.cardHeight
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
WlrLayershell.namespace: "alanfortlink-clipboard"
|
WlrLayershell.namespace: "alanfortlink-clipboard"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.keyboardFocus: root.opened ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
mask: Region {
|
|
||||||
id: panelInputRegion
|
|
||||||
width: 0
|
|
||||||
height: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
BorderSurface {
|
BorderSurface {
|
||||||
id: card
|
id: card
|
||||||
visible: false
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: root.cornerRadius
|
radius: root.cornerRadius
|
||||||
color: root.background
|
color: root.background
|
||||||
@@ -975,7 +938,7 @@ Item {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: root.listWidth + Style.space(14)
|
anchors.leftMargin: root.listWidth + Style.space(14)
|
||||||
result: root.currentResult
|
result: root.currentResult
|
||||||
onOpen: root.openResult(root.currentResult)
|
openAction: function() { root.openResult(root.currentResult) }
|
||||||
visible: root.currentResult !== null
|
visible: root.currentResult !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -13,7 +13,7 @@ Item {
|
|||||||
property var entry: result ? result.row.entry : null
|
property var entry: result ? result.row.entry : null
|
||||||
property string derived: result ? result.row.type : ""
|
property string derived: result ? result.row.type : ""
|
||||||
// Wired by the picker: opens the current result (browser for links).
|
// Wired by the picker: opens the current result (browser for links).
|
||||||
property var onOpen: function() {}
|
property var openAction: function() {}
|
||||||
|
|
||||||
readonly property string font_: Style.font.menuFamily
|
readonly property string font_: Style.font.menuFamily
|
||||||
readonly property color fg: Color.menu.text
|
readonly property color fg: Color.menu.text
|
||||||
@@ -342,7 +342,7 @@ Item {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.onOpen()
|
onClicked: root.openAction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ Item {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.onOpen()
|
onClicked: root.openAction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "alanfortlink.clipboard",
|
"id": "alanfortlink.clipboard",
|
||||||
"name": "Clipboard History",
|
"name": "Clipboard History",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"author": "alanfortlink",
|
"author": "alanfortlink",
|
||||||
"description": "Raycast-style clipboard history: fuzzy search over content, type, app and date, with rich per-type previews",
|
"description": "Raycast-style clipboard history: fuzzy search over content, type, app and date, with rich per-type previews",
|
||||||
"kinds": [
|
"kinds": [
|
||||||
|
|||||||
Reference in New Issue
Block a user