Repository navigation
Fix Emoji Picker for all apps with both keyboard and mouse - #8573
axelfontaine wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Replaces clipboard-based emoji pasting with direct wtype input.
Changes:
- Types selected emojis directly.
- Updates tests for typing and empty input.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-menu-emoji-insert |
Replaces clipboard staging with direct typing. |
test/shell.d/emojis-test.sh |
Updates helper behavior tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
2a661fb to
4315389
Compare
4315389 to
cc260c9
Compare
johnpippett
left a comment
There was a problem hiding this comment.
I tested the insert helper at commit cc260c9a740d8c504dd75df52c6b9090e2b0da58 with command stubs.
In bin/omarchy-menu-emoji-insert, lines 32–36, the loop ends after 15 focus requests even if the original window is not active. The helper then sends the emoji to the active window. This can cause the wrong-window insertion reported in #7350.
In my isolated test, the target was 0xdeadbeef, and hyprctl activewindow always returned 0x0. The helper sent 15 focus requests and then called wtype once. The first test in this PR also keeps the active address different from the target, but it expects insertion.
Please check the active address after the retry loop. If it does not match the target, stop without typing or pasting. Please add a test that requires no insertion when focus cannot return to the original window.
This test covers the helper's failure path. I did not run the picker in a graphical session.
|
Independent check of the paste half, on Omarchy 4.0.4-1 / Firefox 155.0.1, native Wayland. This comment is posted by an AI coding agent (Grok), through GitHub account @tnperron, at the account owner's request. I am not opening another pull request. On a Firefox In foot (window tag I have not run this branch, so this does not cover the origin-window refocus path. |
|
Reviewed at cc260c9 by reading the diff against current It competes with #6892 on the paste half. #6892 (opened 2026-08-14) fixes the same Firefox failure the same way — Ctrl+V outside terminal-tagged windows, the same split The refocus half is separate work that #6892 does not do (#7350, #7379: a mouse-picked emoji landing in the window under the cursor). Two things about it:
Switching terminals from a paste to typing the emoji with No second opinion: the configured reviewer, Codex Medium, refused to run because its daily review budget was spent. This is one model's reading. Waiting on the maintainer to choose between this and #6892. If the refocus fix still reproduces on current |
The retry loop that waits for the picker's origin window to regain focus gave up silently after 15 attempts and fell through to typing or pasting into whatever was focused instead -- exactly the wrong-window bug (omacom#7350) this change set out to fix. Confirmed by @johnpippett's review on PR omacom#8573. Stop without inserting when the origin window never comes back, and cover the failure path with a test (the previous first test inadvertently relied on the bug: it never set the active window to the target address, so it was only passing because of the fallthrough insert). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; no actionable issue remains. SummaryThe picker saves the original window and restores its focus before inserting an emoji.
Reviews (4) · Last reviewed commit: "Wait for the clipboard before the emoji ..." · Reviewed by Greptile |
The retry loop that waits for the picker's origin window to regain focus gave up silently after 15 attempts and fell through to typing or pasting into whatever was focused instead -- exactly the wrong-window bug (omacom#7350) this change set out to fix. Confirmed by @johnpippett's review on PR omacom#8573. Stop without inserting when the origin window never comes back, and cover the failure path with a test (the previous first test inadvertently relied on the bug: it never set the active window to the target address, so it was only passing because of the fallthrough insert). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
86381b2 to
22279d1
Compare
|
Rebased onto current Greptile P1, stale window receives emoji: fixed in 052453e. Checking it live showed two sources, not one. The picker's own last-seen-address fallback, and Quickshell itself: after Hyprland reports no focused window ( Greptile P2, clipboard flags untested: fixed in 22279d1. The @omarchybot, does #7350 still reproduce on the overlay picker? On current Overlap with #6892: the non-terminal half (synthetic Ctrl+V on a transient |
johnpippett
left a comment
There was a problem hiding this comment.
@axelfontaine, thank you for the update. My earlier concern is fixed. I recommend no further change to the helper.
Result
The helper now checks the active window after the retry loop. If the original window is not active, the helper stops. It does not call wtype or wl-copy.
Tested commit
22279d11fbe8658f77eb4bf402b3a8fdf4cc4b8f, on top of quattro at 81145eb1fd41532fcae4310b26f860608e2eaf82. Claude Code did these checks.
Checks and environment
Claude Code ran bin/omarchy-menu-emoji-insert with command stubs for hyprctl, wtype, wl-copy, and sleep. The checks did not use a graphical session.
- The target was
0xdeadbeef.hyprctl activewindow -jalways returned0x0. The helper sent 15 focus requests. It made nowtypecall and nowl-copycall. The exit status was 0. - The result was the same when another window was active (
0x1234). - Focus returned after 5 requests. The helper stopped the retry loop and typed once in a terminal. In a non-terminal window, it called
wl-copy --type text/plain --sensitive --foregroundand thenwtype -M ctrl -P v -p v -m ctrl. - Focus returned after 14 requests. The helper typed once. Focus returned after 16 requests. The helper made no insertion.
- With no window address, the helper sent no focus request. It typed in a terminal and pasted in other windows.
env -i HOME=$HOME PATH=/usr/bin:/bin:<node dir> bash test/shell.d/emojis-test.shpassed all 24 checks. No check was skipped. Thenodedirectory is only in PATH becausenodeis installed undermise.- Claude Code deleted the post-loop
[[ $(active_address) == "$target" ]] || exit 0line on a scratch copy. The testemoji insert helper does not type into the wrong window when the origin never returnsthen failed. The new test therefore guards the fix. The file was then restored.
Remaining concerns
These concerns are minor. None of them blocks the merge.
- When the helper stops, it exits with status 0 and shows no message. A user sees no emoji and no reason.
- The helper checks the active address, and later
is_terminalqueries it again. A focus change between the two queries is possible but unlikely. - If
Hyprland.activeToplevel.workspaceis not set,Emojis.qmlpasses no origin. The helper then uses the old behavior and inserts into the active window. This case seems rare. - The failure test uses
0xothertargetas the active address. The0x0case above behaves the same way. - I see that #6892 also changes the emoji paste. The maintainers can decide how the two pull requests relate. This is not part of my review.
Untested behavior
- Claude Code read the
Emojis.qmlchange inopen(). It usesHyprland.activeToplevelas the origin only when it is onHyprland.focusedWorkspace. The logic looks correct. It was not run. - I did not run the graphical picker.
- I did not test real Hyprland focus changes,
follow_mouse, or multiple monitors. - I did not test whether #7350 reproduces on the new
OverlayWindowpicker.
I prepared this comment with help from AI tools.
|
Thanks for the rebase and the live checks. Reviewed again at 22279d1 by reading it against current The paste half is still the same fix as #6892, which is older and already verified and marked ready: a transient What this adds beyond #6892 is two things, and neither is needed for the Firefox paste failure (#8206):
Codex Medium was the second opinion and read all three pull requests. It agreed that this one is not clearly better than #6892 on the paste half. From the source, it also agreed that closing the picker on Waiting on the maintainer, who chooses between the paste fixes. If they want the terminal typing or the origin guard, those would land most easily as their own small pull request on top of whichever paste fix merges, as you offered. |
The picker copied the emoji to a transient clipboard and simulated
Shift+Insert. Firefox silently ignores a synthetic Shift+Insert (a manual
one works, and synthetic Ctrl+V works), so the emoji never landed there.
There is no one insertion method that works everywhere. Typing the emoji
with wtype works in terminals, Firefox, GTK and Qt, but Chromium- and
Electron-based apps ignore the transient keymap wtype uses for Unicode, so
nothing arrives. A clipboard paste works in all of those GUI apps, but no
single paste shortcut covers terminals too: Ctrl+V is not paste in a
terminal, Ctrl+Shift+V is unbound in Qt.
Split on the same "terminal" window tag omarchy's universal paste keybind
uses (default/hypr/bindings/clipboard.lua). Terminals get the emoji typed,
which also keeps the clipboard and primary selection untouched. Everything
else gets a transient, --sensitive clipboard offer and a synthetic Ctrl+V,
the offer withdrawn straight after. Verified across foot, Firefox,
Chromium, omawrite (Qt), Nautilus (GTK) and IntelliJ, including ZWJ and
flag sequences, with both keyboard and mouse selection.
The picker is a fullscreen layer holding exclusive keyboard focus. When it
closes, follow_mouse hands focus to whichever window is under the centred
cursor, so a mouse-picked emoji went to the wrong window (or none).
Emojis.qml now records the focused window when the picker opens and passes
its address to the helper, which re-focuses that window - via
hl.dsp.focus({ window = "address:..." }), the form that works on current
Hyprland - and confirms it stuck before inserting.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3j2dwT3VnQ7wr9XJUexoK
The retry loop that waits for the picker's origin window to regain focus gave up silently after 15 attempts and fell through to typing or pasting into whatever was focused instead -- exactly the wrong-window bug (omacom#7350) this change set out to fix. Confirmed by @johnpippett's review on PR omacom#8573. Stop without inserting when the origin window never comes back, and cover the failure path with a test (the previous first test inadvertently relied on the bug: it never set the active window to the target address, so it was only passing because of the fallthrough insert). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Opening the picker on an empty workspace targeted a window the picker had seen earlier, so picking an emoji pulled focus back to that window's workspace and inserted it there. Two things kept the stale window: the picker's own last-seen-address fallback, and Quickshell itself, which keeps Hyprland.activeToplevel (still "activated") after Hyprland reports no focused window. Drop the fallback and only take the active window as the origin when it sits on the focused workspace; otherwise pass no origin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22279d1 to
94704bb
Compare
|
@greptile-apps Update your confidence score |
|
Reviewed again at 94704bb, read against current A correction to the last review here. It said closing the picker on The paste half still loses to #6892. Both send Ctrl+V from a transient The refocus half fixes a separate bug that #6892 does not. Three things about it, from reading the source:
#16537 rewrites the same paste line to send keys through Hyprland for XWayland apps, so whichever of these lands first, the others will need a rebase. Codex Medium and muse-wonder (pi, high effort) were the second opinion and were given all three pull requests. Both chose #6892 for the paste fix. Both called the refocus a distinct bug fix worth landing on its own, and both raised the race and the terminal typing. Codex raised the special-workspace gap, which I checked against Quickshell's source. Their agreement with each other is not guaranteed to be independent. Waiting on the maintainer, who chooses between the paste fixes. @axelfontaine, you offered to cut this down. A version with only the origin-window refocus, on top of #6892 or without the paste change, would no longer compete with it and could be verified on its own. |
Now works reliably on
With
Fixes
Supersedes
What changed
omarchy-menu-emoji-insertused to copy the emoji to a transient clipboard and simulateShift+Insertfor every app. It now types the emoji withwtypein terminals and pastes it (transient--sensitiveclipboard + syntheticCtrl+V) everywhere else. The picker also records which window was focused when it opened and re-focuses it before inserting.Why — insertion method
The old copy-and-paste approach relied on the focused app treating
Shift+Insertas "paste clipboard". That breaks:Shift+Insert. A manual one pastes fine, and a syntheticCtrl+V/Ctrl+Shift+Vboth work — but thewtype-generatedShift+Insertdoes nothing, so the emoji never lands.Ctrl+Shift+V(cf. Fix emoji paste in Firefox #6892) fixes Firefox and terminals but is unbound in Qt text widgets, so it misses omawrite and other Qt apps.Ctrl+Vmisses terminals. Sending two shortcuts double-pastes in apps that accept both.wtypeuses for Unicode, so a typed emoji never arrives — those need a real clipboard paste.So no single method works everywhere. The helper splits on the same
terminalwindow tag omarchy's universal-paste keybind already uses (default/hypr/bindings/clipboard.lua): terminals get the emoji typed (clipboard and primary selection stay untouched); everything else gets a transient--sensitiveclipboard offer + syntheticCtrl+V, withdrawn straight after.Why — origin window
The picker is a fullscreen layer holding exclusive keyboard focus. When it closes,
follow_mousehands focus to whichever window is under the (centred) cursor — so an emoji chosen by mouse click was inserted into the wrong window (with the picker straddling two windows, left-side emoji → left window, right-side → right window).Emojis.qmlnow capturesHyprland.activeToplevel.addressinopen()and passes it to the helper, which re-focuses that window withhl.dsp.focus({ window = "address:…" })(the classicdispatch focuswindowform is routed through the Lua dispatcher and errors on current Hyprland) and pollsactivewindowuntil it sticks before inserting. No address (keyboard-only, nothing focused) → unchanged behaviour.Testing
bash test/shell.d/emojis-test.sh— covers the terminal/GUI split, clipboard handling, address normalisation, the refocus loop, and the no-argument path.Fixes #7350
Fixes #7379