Skip to content

Fix clipboard paste into browsers with Ctrl+V - #12377

Open
AndrijaSkontra wants to merge 1 commit into
omacom:quattrofrom
AndrijaSkontra:fix/emoji-insert-browser
Open

AndrijaSkontra wants to merge 1 commit into
omacom:quattrofrom
AndrijaSkontra:fix/emoji-insert-browser

Conversation

@AndrijaSkontra

@AndrijaSkontra AndrijaSkontra commented Sep 18, 2026 •

Copy link
Copy Markdown

Title

Fix clipboard paste into browsers with Ctrl+V

Body

Pasting from the clipboard manager always sent Shift+Insert through wtype. That works in terminals but often fails in browsers.

This adds omarchy-cmd-send-paste, which works the same way as SUPER+V:

omarchy-clipboard-paste-text --shift-insert and omarchy-clipboard-paste-file now use the helper.

Emoji insert is not part of this PR anymore. #6892 handles it.

Tests

test/shell.d/clipboard-test.sh now covers:

  • the wtype fallback for terminals (Shift+Insert) and browsers (Ctrl+V)
  • the successful-dispatch path, checking the down/up send_key_state calls with code:55 for browsers and code:118 for terminals, and that wtype isn't called

@sprajs

sprajs commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The new helper still sends key="V" through send_key_state, which is the non-Latin-layout failure described in #11201 and fixed by #12378. Could the browser/default path use code:55 too, so emoji/clipboard paste gets the same fix as Super+V?

The new tests force every dispatch to fail and only exercise the wtype fallback. A successful-dispatch test checking the down/up keycodes, plus a browser paste check with a non-Latin layout active, would cover the new primary path.

@axelfontaine

Copy link
Copy Markdown
Contributor

@jandrusk

Copy link
Copy Markdown

Browser paste via Ctrl+V (terminals keep Shift+Insert) is the right split — live helpers still always wtype Shift+Insert.

Currently CONFLICTING. Please also send code:55 (not key="V") on the browser path so non-Latin layouts work — same fix as closed #12378 / #11201 (sprajs's review). Overlaps #6892 (Firefox) and broader #8573 / issue #12376 — pick one paste helper and share it.

Shift+Insert via wtype works in terminals but often fails in browsers.
Add omarchy-cmd-send-paste, mirroring SUPER+V: Shift+Insert for
terminal-tagged windows, Ctrl+V elsewhere, preferring Hyprland
send_key_state over wtype. Keys are sent as keycodes (code:55 = V,
code:118 = Insert) so non-Latin layouts work (omacom#11201).
@AndrijaSkontra
AndrijaSkontra force-pushed the fix/emoji-insert-browser branch from 1135336 to ebc8f4d Compare October 13, 2026 07:10
@AndrijaSkontra AndrijaSkontra changed the title Fix emoji/clipboard paste into browsers with Ctrl+V Fix clipboard paste into browsers with Ctrl+V Oct 13, 2026
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Changes how clipboard paste sends keystrokes to windows.

The PR appears safe to merge, with non-blocking improvements to dispatch checks and file-paste tests.

Findings

  1. P2 Paste error replies are ignored ▶
  2. P2 File paste is not tested ▶

Summary

Adds omarchy-cmd-send-paste for clipboard text and file paste.

  • Clipboard pastes use the right key chord for each focused window.

Reviews (1) · Last reviewed commit: "Fix clipboard paste into browsers with C..." · Reviewed by Greptile

send_key_state() {
local mods="$1" key="$2" state="$3"

hyprctl dispatch "hl.dsp.send_key_state({ mods = $(lua_string "$mods"), key = $(lua_string "$key"), state = $(lua_string "$state") })" >/dev/null 2>&1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Paste error replies are ignored

send_key_state discards the reply from hyprctl and checks only its exit status. If hyprctl exits successfully but returns an error, the helper skips wtype and paste can silently stop. The existing dispatch_lua_expression also requires an empty reply or ok. Use the same check here and add a test for an error reply with a successful exit status.

Comment on lines +589 to 590
WL_COPY_OUT="$TMPDIR/copied" WTYPE_OUT="$TMPDIR/wtype" PATH="$TMPDIR/bin:$ROOT/bin:$PATH" \
"$ROOT/bin/omarchy-clipboard-paste-file" --copy-only image/png "$TMPDIR/image.png"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 File paste is not tested

The changed file-paste path has no test that reaches omarchy-cmd-send-paste. Its only test uses --copy-only, which exits before the new call, so the tests would still pass if file paste stopped sending a key. Add a file-paste test without that flag and assert the browser paste chord, while keeping the copied-content check.

@jandrusk

Copy link
Copy Markdown

Thanks for the rebase and the shared omarchy-cmd-send-paste helper — code:55 / code:118 via send_key_state is exactly the non-Latin fix from #11201, and GitHub shows it mergeable now.

LGTM from my side. Greptile's P2s (check hyprctl error replies before skipping wtype; add a non---copy-only file-paste test) are worth a quick pass but not blockers for the browser Ctrl+V path.

@omarchybot omarchybot removed the enhancement New feature or request label Oct 14, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I looked at this revision (ebc8f4d) to decide whether it is a bug fix or a new feature before verifying it, and the two models that classify items separately did not agree. Claude Opus 5.5 read it as a bug: pasting a clipboard-manager entry into a browser sends Shift+Insert through wtype today, which browsers often ignore, so the paste silently does nothing. Codex Medium read it as an enhancement: it adds a new helper, omarchy-cmd-send-paste, and deliberately changes which chord the clipboard manager sends outside terminals.

Because the classification is unsettled, I have taken the enhancement label off and added no class label, and nothing was run on a worker yet. This waits on the maintainer to say which it is. Nothing is needed from you in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants