repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(quickshell): add clipboard picker ipc surface

21b0bb25aaa35ffd25d092989c12a599a72febf4

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (5)

docs/super/inventory/2026-06-17-quickshell-phase-4c-clipboard-picker-verification.md

Added
new file mode 100644
1 +# Quickshell Phase 4C Clipboard Picker Verification — 2026-06-17
3 +## Scope
5 +Added a full Quickshell clipboard picker IPC surface. This replaces the `hyprlauncher --dmenu` frontend path later, while keeping `cliphist` as the clipboard storage backend.
7 +## Implemented files
9 +- `quickshell/nugu/ClipboardPicker.qml`
10 +- `quickshell/nugu/shell.qml` IPC wiring
11 +- `quickshell/nugu/ClipboardWidget.qml` copy input fix
12 +- `quickshell/nugu/README.md` usage notes
14 +## Design decision
16 +Current Hypr bind uses:
18 +```sh
19 +cliphist list | hyprlauncher --dmenu | cliphist decode | wl-copy
20 +```
22 +The new picker keeps `cliphist list`, `cliphist decode`, and `wl-copy`. Only the picker frontend changes.
24 +Validation showed `cliphist decode` needs the full selected `cliphist list` line. Passing only the numeric id does not decode correctly:
26 +```text
27 +found=1 id_decode=0 line_decode=1
28 +```
30 +So both the bar clipboard popup and the full picker now pass the full selected line to `Commands.copyClipboardEntry()`.
32 +## IPC tested
34 +A synthetic non-secret clipboard entry was inserted for the test. The previous clipboard text was saved to a temporary file and restored afterward without printing it.
36 +Temporary `XDG_CONFIG_HOME` named config was used; no live home symlink mutation.
38 +```sh
39 +qs ipc -c nugu call nugu openClipboardPicker <synthetic-query>
40 +qs ipc -c nugu call nugu clipboardPickerVisible
41 +qs ipc -c nugu call nugu clipboardPickerMatchCount
42 +qs ipc -c nugu call nugu chooseClipboardIndex 0
43 +qs ipc -c nugu call nugu clipboardPickerVisible
44 +```
46 +Observed returns, redacted:
48 +```text
49 +open=[synthetic-clipboard-entry]
50 +visible=true
51 +count=1
52 +choose=[synthetic-clipboard-entry]
53 +visible_after=false
54 +chosen_ok=1
55 +```
57 +`chosen_ok=1` means `wl-paste --no-newline` matched the synthetic entry after selecting index 0.
59 +Runtime output:
61 +```text
62 +INFO: Configuration Loaded
63 +```
65 +No QML errors, binding loops, reference errors, annotation warnings, or lingering `qs` process were observed after the fix.
67 +## Screenshot
69 +- `/tmp/nugu-qs-clipboard-picker.png`
71 +Vision check confirmed:
73 +- Nugu clipboard picker popup is visible.
74 +- Search field is visible.
75 +- One matching synthetic row is shown and highlighted.
76 +- Border/background style matches the other Nugu popups.
77 +- Text is readable.
79 +## Still open before replacing the live clipboard bind
81 +- Real keyboard navigation: type, up/down, escape, enter.
82 +- Live Hypr bind migration once Quickshell service is active/recoverable.
83 +- Empty-history behavior with a temporary isolated `cliphist` database if supported.

quickshell/nugu/ClipboardPicker.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell
3 +import Quickshell.Io
4 +import Quickshell.Wayland
6 +PanelWindow {
7 + id: root
9 + required property QtObject theme
10 + required property QtObject commands
11 + property bool open: false
12 + property string query: ""
13 + property var entries: []
15 + // This replaces `cliphist list | hyprlauncher --dmenu | cliphist decode | wl-copy`.
16 + // Storage deliberately remains `cliphist`; only the picker frontend moves to QML.
17 + visible: open
18 + focusable: open
19 + anchors { top: true; left: true; right: true }
20 + margins { top: 62 }
21 + exclusiveZone: -1
22 + implicitHeight: 390
23 + color: "transparent"
25 + WlrLayershell {
26 + layer: WlrLayer.Overlay
27 + namespace: "nugu-clipboard-picker"
28 + keyboardFocus: root.open ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
29 + }
31 + ScriptModel { id: matches }
33 + onQueryChanged: rebuild()
34 + onOpenChanged: {
35 + if (open) {
36 + refresh()
37 + Qt.callLater(search.forceActiveFocus)
38 + }
39 + }
41 + function show(initialQuery: string): string {
42 + query = initialQuery
43 + open = true
44 + return query
45 + }
47 + function close(): void {
48 + open = false
49 + query = ""
50 + }
52 + function matchCount(): int { return matches.values.length }
53 + function firstMatchPreview(): string { return matches.values.length > 0 ? matches.values[0].preview : "" }
55 + function refresh(): void {
56 + list.exec(["sh", "-c", "cliphist list | head -n 80"])
57 + }
59 + function rebuild(): void {
60 + const needle = query.toLowerCase().trim()
61 + matches.values = entries
62 + .filter(entry => needle.length === 0 || entry.search.indexOf(needle) !== -1)
63 + .slice(0, 16)
64 + results.currentIndex = matches.values.length > 0 ? 0 : -1
65 + }
67 + function chooseIndex(index: int): string {
68 + if (index < 0 || index >= matches.values.length) return ""
69 + const entry = matches.values[index]
70 + commands.copyClipboardEntry(entry.encoded, entry.preview)
71 + close()
72 + return entry.preview
73 + }
75 + function parseLine(line: string): var {
76 + const tab = line.indexOf("\t")
77 + const encoded = line
78 + const raw = tab >= 0 ? line.slice(tab + 1) : line
79 + const compact = raw.replace(/\s+/g, " ").trim()
80 + const preview = compact.length > 80 ? `${compact.slice(0, 77)}…` : compact
81 + return { "encoded": encoded, "preview": preview, "search": compact.toLowerCase() }
82 + }
84 + MouseArea {
85 + anchors.fill: parent
86 + onClicked: root.close()
87 + }
89 + Rectangle {
90 + anchors.top: parent.top
91 + anchors.horizontalCenter: parent.horizontalCenter
92 + width: Math.min(parent.width - 32, 720)
93 + height: parent.height
94 + radius: 14
95 + color: `${theme.ui.backdrop}f2`
96 + border.width: 2
97 + border.color: theme.ui.accent
99 + Column {
100 + anchors.fill: parent
101 + anchors.margins: 14
102 + spacing: 10
104 + TextInput {
105 + id: search
106 + width: parent.width
107 + height: 42
108 + text: root.query
109 + onTextChanged: root.query = text
110 + color: theme.ui.important_global
111 + selectionColor: theme.ui.focus
112 + selectedTextColor: theme.content.backdrop
113 + font.family: "IBM Plex Mono"
114 + font.pixelSize: 18
115 + font.bold: true
116 + clip: true
118 + Rectangle {
119 + anchors.fill: parent
120 + anchors.margins: -6
121 + z: -1
122 + radius: 9
123 + color: theme.content.backdrop
124 + border.width: 1
125 + border.color: theme.ui.unfocus
128 + Keys.onPressed: event => {
129 + if (event.key === Qt.Key_Escape) {
130 + root.close()
131 + event.accepted = true
132 + } else if (event.key === Qt.Key_Down) {
133 + results.currentIndex = Math.min(results.currentIndex + 1, matches.values.length - 1)
134 + event.accepted = true
135 + } else if (event.key === Qt.Key_Up) {
136 + results.currentIndex = Math.max(results.currentIndex - 1, 0)
137 + event.accepted = true
138 + } else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
139 + root.chooseIndex(results.currentIndex)
140 + event.accepted = true
145 + ListView {
146 + id: results
147 + width: parent.width
148 + height: parent.height - search.height - parent.spacing
149 + model: matches
150 + clip: true
151 + spacing: 4
153 + delegate: Rectangle {
154 + id: row
155 + required property var modelData
156 + required property int index
158 + width: results.width
159 + height: 34
160 + radius: 8
161 + color: results.currentIndex === index ? theme.ui.focus : (rowMouse.containsMouse ? theme.ui.accent : "transparent")
162 + clip: true
164 + MouseArea {
165 + id: rowMouse
166 + anchors.fill: parent
167 + hoverEnabled: true
168 + onClicked: root.chooseIndex(row.index)
171 + Text {
172 + anchors.left: parent.left
173 + anchors.right: parent.right
174 + anchors.verticalCenter: parent.verticalCenter
175 + anchors.leftMargin: 10
176 + anchors.rightMargin: 10
177 + text: row.modelData.preview
178 + color: (results.currentIndex === row.index || rowMouse.containsMouse) ? theme.content.backdrop : theme.ui.normal
179 + font.family: "IBM Plex Mono"
180 + font.pixelSize: 13
181 + elide: Text.ElideRight
186 + Text {
187 + visible: matches.values.length === 0
188 + text: root.entries.length === 0 ? "clipboard empty" : "no clipboard match"
189 + color: theme.ui.minor
190 + font.family: "IBM Plex Mono"
191 + font.pixelSize: 13
196 + Process {
197 + id: list
198 + stdout: StdioCollector {
199 + onStreamFinished: {
200 + const text = this.text.trim()
201 + root.entries = text.length === 0 ? [] : text.split("\n").map(line => root.parseLine(line))
202 + root.rebuild()

quickshell/nugu/ClipboardWidget.qml

Modified
116 116 onStreamFinished: {
117 117 root.entries = this.text.trim().length === 0 ? [] : this.text.trim().split("\n").map(line => {
118 118 const tab = line.indexOf("\t")
119 - const encoded = tab >= 0 ? line.slice(0, tab) : line
119 + const encoded = line
120 120 const raw = tab >= 0 ? line.slice(tab + 1) : line
121 121 const compact = raw.replace(/\s+/g, " ")
122 122 const preview = compact.length > 30 ? `${compact.slice(0, 27)}…` : compact

quickshell/nugu/README.md

Modified
116 116 qs ipc -c nugu call nugu launcherFirstMatchName
117 117 qs ipc -c nugu call nugu closeLauncher
120 +## Phase 4C clipboard picker IPC
122 +Phase 4C replaces only the picker frontend from the old pipeline:
124 +```sh
125 +cliphist list | hyprlauncher --dmenu | cliphist decode | wl-copy
126 +```
128 +`cliphist` remains the storage backend. The picker passes the full selected
129 +`cliphist list` line to `cliphist decode`; passing only the numeric id does not
130 +decode correctly.
132 +```sh
133 +qs ipc -c nugu call nugu openClipboardPicker query
134 +qs ipc -c nugu call nugu clipboardPickerVisible
135 +qs ipc -c nugu call nugu clipboardPickerMatchCount
136 +qs ipc -c nugu call nugu chooseClipboardIndex 0
137 +qs ipc -c nugu call nugu closeClipboardPicker
138 +```

quickshell/nugu/shell.qml

Modified
75 75 function launcherVisible(): bool { return launcher.open }
76 76 function launcherMatchCount(): int { return launcher.matchCount() }
77 77 function launcherFirstMatchName(): string { return launcher.firstMatchName() }
79 + // Full clipboard picker IPC replaces `hyprlauncher --dmenu` later while
80 + // keeping `cliphist` as the storage backend for safety and parity.
81 + function openClipboardPicker(query: string): string { return clipboardPicker.show(query) }
82 + function closeClipboardPicker(): void { clipboardPicker.close() }
83 + function clipboardPickerVisible(): bool { return clipboardPicker.open }
84 + function clipboardPickerMatchCount(): int { return clipboardPicker.matchCount() }
85 + function clipboardPickerFirstPreview(): string { return clipboardPicker.firstMatchPreview() }
86 + function chooseClipboardIndex(index: int): string { return clipboardPicker.chooseIndex(index) }
80 89 Loader {
95 104 theme: nuguTheme
107 + ClipboardPicker {
108 + id: clipboardPicker
109 + theme: nuguTheme
110 + commands: commandBus
98 113 // Create one bar per monitor, matching Ironbar's multi-output behavior.
99 114 Variants {
100 115 model: Quickshell.screens