Repository navigation
Conversation
Enter still pastes. Ctrl+Enter types the selected text through wtype at ~20 characters/sec, which is useful when paste is blocked. Layer-shell overlays often see Ctrl+Enter as plain Enter, so the picker also installs a compositor bind while it is open.
Automated AI review
Outcome: The helper now strips trailing newlines from every history paste and copy, not only typing. Return and Shift+Return lose trailing newlines
Suggested change: keep the direct Reproducer (fails at 4e18ce8)Reviewed head: 4e18ce8. Base for comparison: 692c02c (merge base). Cause: Test (append to
|
| Entry text (JSON) | Mode | Base wl-copy bytes | Head wl-copy bytes |
|---|---|---|---|
"echo hi\n" |
--shift-insert --history-index 0 |
65 63 68 6f 20 68 69 0a |
65 63 68 6f 20 68 69 |
"echo hi\n" |
--copy-only --history-index 0 |
65 63 68 6f 20 68 69 0a |
65 63 68 6f 20 68 69 |
"a\n\n\n" |
--copy-only --history-index 0 |
61 0a 0a 0a |
61 |
"foo<NUL>bar" |
--copy-only --history-index 0 |
66 6f 6f 00 62 61 72 |
66 6f 6f 62 61 72 (stderr: warning: command substitution: ignored null byte in input) |
"line one\r\nline two\r\n" |
--copy-only --history-index 0 |
... 74 77 6f 0d 0a |
... 74 77 6f 0d |
(<NUL> stands for the JSON escape for U+0000.) The existing assertions cannot see this: the fixture entry is built with "$(printf '...\n')" (already stripped) and compared with $(<file) (strips again).
Closing the overlay removes user Ctrl+Return binds
hl.unbind("CTRL + RETURN") removes every bind spelled CTRL + RETURN in Hyprland 0.56.2 and main (from source, not run). Impact: a user's own such bind is lost on the first close until a config reload; after a shell crash while open, Ctrl+Return stays captured until the next open and close.
Suggested change: create one disabled bind in Lua config and toggle it with set_enabled (see Details).
More findings: overlay state after Ctrl+Return, rebase onto current quattro
Ctrl+Return leaves overlay state set for the next open
Ctrl+Return hides the overlay with opened = false, bypassing close(), so ctrlHeld and clearConfirmOpen survive, and typeCurrent() ignores the delete confirmation. Impact: a later Return or Shift+Return can type instead of paste or copy, and Ctrl+Return during "Delete entire clipboard history?" types the entry and leaves that dialog armed.
Suggested change: reset both flags when opened becomes false and return early from typeCurrent() while clearConfirmOpen is set.
The bare IpcHandler fails shell-ipc-socket-test.sh after a merge with quattro
quattro now requires first-party IPC handlers to use ShellIpc (#13435). Merged into the current tip, the PR's IpcHandler makes test/shell.d/shell-ipc-socket-test.sh fail; it still works at runtime through the slower qs ipc fallback. Impact: an existing test fails after the merge, which is otherwise conflict-free.
Suggested change: declare the handler as ShellIpc { target: "omarchy.clipboard"; ... } when rebasing; the PR's own assertion still matches.
Reproducer: Control state (fails at 4e18ce8, headless QML harness)
Reviewed head: 4e18ce8.
Cause: Keys.onPressed sets ctrlHeld = true on the Control press and only Keys.onReleased (or close()) clears it. Ctrl+Return hides the overlay through typeSelected(), which sets root.opened = false directly and does not go through close(). If Control is still held when the overlay hides (the usual case), the release goes to the window that regains focus. open() does not reset the flag. On the next open, wantsType() returns true for any Return, and the Return branch checks wantsType before Shift, so Return and Shift+Return both call --type.
When it shows: the next open gets no Control release, for example via omarchy menu clipboard, a user binding without Ctrl, or a quick Super+Ctrl+V tap that is released before the overlay has focus. Escape, a click outside the card, or Super+Ctrl+V to close go through close() and clear it.
Harness
Headless Qt Quick Test (qmltestrunner, QT_QPA_PLATFORM=offscreen, Qt 6.11.2) loading the PR's Clipboard.qml and ClipboardHistory.js unchanged except for removing the four PanelWindow lines that only exist under Quickshell (anchors { top: true; ... } and three WlrLayershell.* attached properties). Quickshell, Quickshell.Io, qs.Commons and qs.Ui are test doubles: Quickshell.execDetached records argv instead of running anything, PanelWindow is a plain Item, ConfirmDialog.handleKey is copied verbatim. Key events are sent with QtTest's keyPress/keyClick.
The test models the PR's main path: the overlay receives the Control press, Return is consumed by the compositor CTRL + RETURN bind, which calls typeCurrent() over IPC.
function test_08_return_after_compositor_ctrl_return_pastes() {
openWithHistory() // two text entries, c.open("{}")
keyPress(Qt.Key_Control) // Control reaches the overlay
compare(c.typeCurrent(), "ok") // Return taken by the compositor bind
compare(helperLog()[0], "--type --history-index 0")
Quickshell.reset()
c.open("{}"); wait(50) // reopened without a Control key event
keyClick(Qt.Key_Return, Qt.ShiftModifier)
compare(helperLog()[0], "--copy-only --history-index 0", "Shift+Return copies on the next open")
}(helperLog() lists the arguments of every recorded omarchy-clipboard-* helper call.)
Actual output at the PR head
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_08_return_after_compositor_ctrl_return_pastes() qml: OBSERVED Shift+Return on next open: ["--type --history-index 0"]
FAIL! : qmltestrunner::ClipboardTypeKeys::test_08_return_after_compositor_ctrl_return_pastes() Shift+Return copies on the next open
Actual (): --type --history-index 0
Expected (): --copy-only --history-index 0
The same test with a plain keyClick(Qt.Key_Return) on the next open (expecting the paste call):
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_08b_plain_return_after_compositor_ctrl_return_pastes() qml: OBSERVED plain Return on next open (compositor path): ["--type --history-index 0"]
FAIL! : qmltestrunner::ClipboardTypeKeys::test_08b_plain_return_after_compositor_ctrl_return_pastes() plain Return pastes on the next open
Actual (): --type --history-index 0
Expected (): --shift-insert --history-index 0
Same results with the PR merged into current quattro (where the overlay is an OverlayWindow).
With ctrlHeld (and clearConfirmOpen) reset when opened becomes false, both pass:
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_08_return_after_compositor_ctrl_return_pastes() qml: OBSERVED Shift+Return on next open: ["--copy-only --history-index 0"]
PASS : qmltestrunner::ClipboardTypeKeys::test_08_return_after_compositor_ctrl_return_pastes()
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_08b_plain_return_after_compositor_ctrl_return_pastes() qml: OBSERVED plain Return on next open (compositor path): ["--shift-insert --history-index 0"]
PASS : qmltestrunner::ClipboardTypeKeys::test_08b_plain_return_after_compositor_ctrl_return_pastes()
Candidate change used for that run:
- onOpenedChanged: root.setTypeBind(root.opened)
+ onOpenedChanged: {
+ if (!root.opened) {
+ root.ctrlHeld = false
+ root.clearConfirmOpen = false
+ }
+ root.setTypeBind(root.opened)
+ }Limit: the harness cannot model the compositor moving keyboard focus away (in the harness, a hidden item still receives key events), so the "Control release is not delivered" step is represented by not sending it. The test does not run Hyprland or Quickshell.
Reproducer: delete confirmation (fails at 4e18ce8, headless QML harness)
Reviewed head: 4e18ce8.
Cause: while the overlay is open the compositor CTRL + RETURN bind is active, so Ctrl+Return never reaches QML; it calls typeCurrent() over IPC. typeCurrent() checks opened and the row count but not clearConfirmOpen (the PR's Shortcut is disabled while the confirmation is open, the IPC path is not). typeSelected() hides the overlay with root.opened = false, which skips close() and therefore cancelClearHistory(). open() does not reset clearConfirmOpen, so the next open shows the confirmation again with Delete preselected (requestClearHistory() sets selectedIndex = 1).
Harness
Same headless Qt Quick Test harness as the Control-state reproducer: the PR's Clipboard.qml with Quickshell-only PanelWindow lines removed, test doubles for Quickshell, Quickshell.Io, qs.Commons, qs.Ui (ConfirmDialog.handleKey copied verbatim), Quickshell.execDetached recording argv only.
function test_09_ctrl_return_in_clear_confirm() {
openWithHistory() // two text entries, c.open("{}")
keyClick(Qt.Key_Delete, Qt.ShiftModifier) // "Delete entire clipboard history?"
compare(c.clearConfirmOpen, true)
var result = c.typeCurrent() // Ctrl+Return, taken by the compositor bind
var typedDuringConfirm = helperLog().length
if (!c.opened) {
c.open("{}"); wait(50) // next normal open
keyClick(Qt.Key_Return)
}
compare(typedDuringConfirm, 0, "Ctrl+Return does not type while the delete confirmation is open")
compare(c.history.length, 2, "history survives")
}Actual output at the PR head
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_09_ctrl_return_in_clear_confirm() qml: OBSERVED typeCurrent during confirm: ok ["--type --history-index 0"] opened=false clearConfirmOpen=true
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_09_ctrl_return_in_clear_confirm() qml: OBSERVED next open: clearConfirmOpen=true
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_09_ctrl_return_in_clear_confirm() qml: OBSERVED after Return on next open: history length=0 ["--type --history-index 0"]
FAIL! : qmltestrunner::ClipboardTypeKeys::test_09_ctrl_return_in_clear_confirm() Ctrl+Return does not type while the delete confirmation is open
Actual (): 1
Expected (): 0
So the entry is typed into the previously focused window while the modal confirmation is showing, the confirmation is still open on the next launch, and a plain Return there clears the whole history. Same result with the PR merged into current quattro.
With if (root.clearConfirmOpen) return "confirming" in typeCurrent() (plus resetting clearConfirmOpen when opened becomes false), the test passes:
QDEBUG : qmltestrunner::ClipboardTypeKeys::test_09_ctrl_return_in_clear_confirm() qml: OBSERVED typeCurrent during confirm: confirming [] opened=true clearConfirmOpen=true
PASS : qmltestrunner::ClipboardTypeKeys::test_09_ctrl_return_in_clear_confirm()
Limit: the compositor bind is represented by calling typeCurrent() directly; Hyprland and Quickshell IPC are not run. That Hyprland consumes a matching bind's key press (so QML does not also see it) is from Hyprland source (CKeybindManager::handleKeybinds: a non-non_consuming bind sets found = true, so the event is not passed to the client).
Reproducer: rebase onto quattro (fails on the merge)
Reviewed head: 4e18ce8. quattro tip: 8b4eae6.
quattro gained shell/Commons/ShellIpc.qml (an IpcHandler that also registers with IpcRegistry, so omarchy-shell can answer over the shell's own socket, #13435) and a test that every first-party handler uses it. The PR adds a bare IpcHandler { target: "omarchy.clipboard" ... } to shell/plugins/clipboard/Clipboard.qml. The merge is textually clean.
Steps
(Not run as written: the review built the equivalent clean merge in its own clone and ran the test there.)
git fetch origin quattro pull/11701/head:pr-11701
git checkout --detach origin/quattro
git merge --no-edit pr-11701 # merges without conflicts
bash test/shell.d/shell-ipc-socket-test.shActual output (last lines; exit 1)
ok - a stale socket with nothing listening falls back to qs ipc
ok - without the socket calls go through qs ipc
ok - a call for another display does not reach this shell's socket
expected: ["shell/Commons/IpcRegistry.qml","shell/Commons/ShellIpc.qml"]
actual: ["shell/Commons/IpcRegistry.qml","shell/Commons/ShellIpc.qml","shell/plugins/clipboard/Clipboard.qml"]
not ok - first-party IPC handlers register through ShellIpc
The same test passes on quattro alone. test/shell.d/clipboard-test.sh (including the PR's six new assertions) passes on the merge.
Fix on rebase: declare the handler as ShellIpc { target: "omarchy.clipboard"; function typeCurrent(): string { ... } }. The PR's own assertion (target: "omarchy.clipboard"[\s\S]*function typeCurrent\(\): string) still matches.
Details
Ctrl+Return bind mechanism. In Hyprland 0.56.2 hlUnbind calls CKeybindManager::removeKeybind(displayKeys), which erases every bind whose normalized display key matches, across submaps; Hyprland main does the same through removeByDisplayKey. While the overlay is open, a user's own Ctrl+Return bind also fires (0.56.2). default/hypr/bindings/utilities.lua (lines 48-49) already warns about unbinding by key. On 0.56.2 even a kept handle's remove() erases by modifier and key, so a disabled bind toggled with set_enabled is safer. Sketch (source-checked against 0.56.2 and main, not run):
omarchy_clipboard_type_bind = hl.bind("CTRL + RETURN", hl.dsp.exec_cmd("omarchy-shell -q omarchy.clipboard typeCurrent"), { description = "Type clipboard entry" })
omarchy_clipboard_type_bind:set_enabled(false)QML then runs hyprctl eval 'omarchy_clipboard_type_bind:set_enabled(true)' on open and (false) on close. Disabled binds are skipped without consuming the key, and a config reload recreates the bind disabled.
Verified
wtype -d 50 -types from stdin with a 50 ms delay (about 18 characters per second); leading-dash and non-ASCII text stays off argv.- Invalid indexes (
abc,-1,99) exit without copying; empty text types nothing;--copy-onlytakes precedence over--type. - In the headless QML harness, Return pastes, Shift+Return copies, Ctrl+Return types once,
typeCurrentfollows the highlighted row, and bind and unbind pair up on Escape, paste, type and shell reload. - The PR's clipboard tests pass at the head and merged into current
quattro.
Optional test improvements
- The "Ctrl+Enter types the selected entry" assertion still passes when the Return branch calls
activateIndex, because[\s\S]*reaches theShortcut'stypeIndex; anchor it to theKeysbranch. - The
wtypestub records only argv, so the new test still passes when the helper sends empty stdin; record stdin and compare the typed bytes.
Untested: whether Control still held after the 0.3 s delay alters the first typed characters needs a real compositor run.
Related open PRs: #8350, #12801, #12991, #13103 and #11920 conflict in bin/omarchy-clipboard-paste-text; #7452, #10919, #13103 and #11920 conflict in Clipboard.qml. #12991 and #13103 refocus the origin window before pasting, which typing would also need.
Review information
Test scope: Source, sandboxed shell tests and a headless QML harness at 4e18ce8; Hyprland and Quickshell not run.
AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.
Opt out: To stop receiving these reviews, reply to this comment saying so.
|
Two things on the current head (
jq -j --argjson index "$history_index" '.[$index].text' "$history_path" | wl-copy
if [[ $type_keys == "true" ]]; then
text=$(jq -j --argjson index "$history_index" '.[$index].text' "$history_path"; printf x)
text=${text%x}
fi
|
Summary
Enter in the clipboard manager still pastes. Ctrl+Enter types the selected text as keystrokes at ~20 characters/sec instead of pasting.
This is for fields that block paste (some password inputs, remote desktops, kiosk apps) while still accepting real keystrokes.
Typing is text-only; images keep the existing paste path.
Shortcuts (clipboard overlay)
How
omarchy-clipboard-paste-text --typecopies the history entry, waits for the overlay to close, then runswtype -d 50 -so the text is typed from stdin (newlines/quotes never hit argv).Shortcut/ShortcutOverride/ Control held).CTRL + RETURNcallsomarchy.clipboard typeCurrent; it is unbound on close so Ctrl+Enter stays free in other apps.Related open PRs (not the same feature)
Checked open PRs/issues before opening this:
autoPastetoggle (Enter copies instead of pastes).None of those type the clip as keystrokes.
Testing
bash test/shell.d/clipboard-test.shpasses, including new--typehelper assertions and QML wiring checks../test/all: clipboard tests pass. Unrelated failures on this machine:config-test.sh,launch-about-test.sh,locate-test.sh,runtime-smoke-test.sh,snapper-test.sh,unowned-system-paths-test.sh(missingomarchy-pkgs/ compositor IPC counts).Docs
manual/08-unified-clipboard-history.mdlists the overlay keys.