omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Clipboard: selecting entry auto-pastes into focused terminal

Open nightdevil00 opened this issue 3 months ago • 1 comments

Problem

Selecting an entry from the clipboard manager (omarchy.clipboard) auto-pastes it into the focused terminal via wtype -M shift -k Insert. This is unexpected — users expect a clipboard manager to copy the selected entry to the clipboard, not immediately paste it.

The auto-paste is disruptive because:

  • It inserts text into whatever terminal/app is focused without consent
  • Users who just want to copy an older clipboard entry end up pasting it accidentally
  • It differs from standard clipboard manager behavior (e.g.clipmenu, CopyQ)

Expected Behavior

  • Enter / Click → Copy selected entry to clipboard only (no paste)
  • Shift+Enter → Copy and paste (Shift+Insert)
  • Alt+Enter → Open entry in default app

Actual Behavior

  • Enter / Click → Copies AND auto-pastes into focused window
  • Shift+Enter → Copies only (the expected copy-only behavior is swapped)

Steps to Reproduce

  1. Open a terminal
  2. Copy some text (e.g. echo "hello")
  3. Copy different text (e.g. echo "world")
  4. Open clipboard manager (default binding)
  5. Select the first entry with Enter
  6. "hello" is auto-pasted into the terminal

Root Cause

In Clipboard.qml, the activateIndex (which copies + pastes) and copyIndex (copy only) are swapped relative to user expectations:

  • Line ~388 (keyboard handler): Enter triggers activateIndex instead of copyIndex
  • Line ~523 (mouse click handler): Click triggers activateIndex instead of copyIndex

Workaround

I've cloned the plugin and swapped the call order in ~/.config/omarchy/plugins/mihai.clipboard/Clipboard.qml:

# Keyboard handler (~line 388)
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
  if (root.cursorActive && (event.modifiers & Qt.AltModifier)) root.openIndex(root.selectedIndex)
-  else if (root.cursorActive && (event.modifiers & Qt.ShiftModifier)) root.copyIndex(root.selectedIndex)
-  else if (root.cursorActive) root.activateIndex(root.selectedIndex)
+  else if (root.cursorActive && (event.modifiers & Qt.ShiftModifier)) root.activateIndex(root.selectedIndex)
+  else if (root.cursorActive) root.copyIndex(root.selectedIndex)
  else if (displayModel.count > 0) root.cursorActive = true

# Mouse click handler (~line 523)
onClicked: {
  root.cursorActive = true
  root.selectedIndex = row.index
-  root.activateIndex(row.index)
+  root.copyIndex(row.index)
}

System Details

  • Omarchy version: 4.0.0-1
  • CPU: Intel Core i7-10750H
  • GPU: Intel UHD Graphics / NVIDIA GTX 1650 Ti Mobile
  • Shell: Quickshell with omarchy.clipboard plugin

Suggestion

Consider making "copy only" the default action for Enter/Click, and requiring Shift+Enter for copy+paste. This matches the behavior of most clipboard managers and avoids accidental text insertion.

nightdevil00 avatar Aug 20 '26 14:08 nightdevil00

I checked this against the source on quattro (b83d3df08). It was not run on a worker because the source settles the behaviour on its own, and nothing here depends on hardware.

What you describe is accurate. In shell/plugins/clipboard/Clipboard.qml, Enter and a click call activateIndex (lines 387 and 524), which copies the entry and then sends Shift+Insert to the focused window through bin/omarchy-clipboard-paste-text or omarchy-clipboard-paste-file. Shift+Enter calls copyIndex (line 386), which passes --copy-only and stops after copying. Alt+Enter opens the entry.

The handlers were not swapped by accident, though. Copy-and-paste on Enter has been the behaviour since the helpers were first written, and Shift+Enter was added later as a separate copy-only action in bb0d9dd2e ("Copy clipboard history selection with Shift Return"). So making copy-only the default would be a change of design, and that is the maintainer's decision.

There is a real inconsistency, though. manual/08-unified-clipboard-history.md says that pressing Return puts the entry on the clipboard "ready to paste on Super + V". That describes the copy-only behaviour you are asking for, not what Enter does now, and the manual doesn't mention Shift+Enter or Alt+Enter at all. Whichever behaviour is kept, either the manual or the code needs to change to match the other. Open PR #11677 adds the Delete keys to that page but doesn't touch this sentence.

Related, but not duplicates: #12987 and its PRs #12991 and #13103 cover where the paste lands after a click, not whether Enter should paste.

Codex at medium effort reviewed this separately through omabot's second-opinion step and reached the same conclusion from the source and the git history: the behaviour is deliberate, and the manual doesn't match it. It had read access to this session, so its agreement is not guaranteed to be independent. This is now waiting on the maintainer to decide which behaviour Enter should have.

omarchybot avatar Oct 08 '26 12:10 omarchybot