Skip to content

Fix emoji picker paste for Firefox and mouse selection - #10591

Closed
fresh3nough wants to merge 1 commit into
omacom:quattrofrom
fresh3nough:fix/10382-emoji-firefox-paste
Closed

fresh3nough wants to merge 1 commit into
omacom:quattrofrom
fresh3nough:fix/10382-emoji-firefox-paste

Conversation

@fresh3nough

@fresh3nough fresh3nough commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #10382.

omarchy-menu-emoji-insert used a transient clipboard offer plus synthetic Shift+Insert. That breaks in several ways:

  • Firefox-based browsers (Firefox, Zen, LibreWolf) map Shift+Insert to PRIMARY, so a clipboard-only offer pastes nothing (manual Ctrl+V worked).
  • Chromium / Electron ignore the transient keymap wtype uses for Unicode, so typing an emoji never arrives — they need a real clipboard paste.
  • Mouse selection: the picker is a fullscreen exclusive-focus layer; when it closes, follow_mouse focuses whatever window is under the (centred) cursor, so a mouse-picked emoji often lands in the wrong window.

Change

  • Emojis.qml captures Hyprland.activeToplevel.address in open() (with a last-known fallback) and passes it to the insert helper.
  • omarchy-menu-emoji-insert:
    • optional [window-address] argument; normalises bare hex, re-focuses via hl.dsp.focus (classic focuswindow fallback), polls until active;
    • terminal tag → wtype the emoji (clipboard untouched);
    • otherwise → sensitive clipboard offer + synthetic Ctrl+V, then withdraw.

Related: #8573 takes the same overall approach and is acknowledged in review; this PR brings that shape onto current quattro for #10382.

Evidence

bash test/shell.d/emojis-test.sh
ok - emoji insert helper types the emoji into a focused terminal
ok - emoji insert helper waits for focus to settle before inserting
ok - emoji insert helper leaves the clipboard alone for a terminal
ok - emoji insert helper refocuses the picker's origin window by address
ok - emoji insert helper normalises a bare window address
ok - emoji insert helper stops refocusing once the origin window is active
ok - emoji insert helper puts the emoji on the clipboard for a GUI app
ok - emoji insert helper sends Ctrl+V to paste into a GUI app
ok - emoji insert helper does not inject raw Unicode into a GUI app
ok - emoji insert helper defaults to paste for an untagged window
ok - emoji insert helper still inserts without a window address
ok - emoji insert helper skips refocus without a window address
ok - emoji insert helper does nothing without an emoji argument
ok - emoji insert helper exits before sleeping without an emoji argument
ok - emoji insert helper exits before querying hyprctl without an emoji argument
ok - emojis picker imports Hyprland for origin window address
ok - emojis picker records targetWindow for mouse origin restore
ok - emojis picker passes origin window address to insert helper
ok - emoji insert documents issue #10382

Test plan

  • Stub harness: terminal tag → type emoji, no clipboard
  • Stub harness: Firefox-tagged / untagged GUI → clipboard + Ctrl+V
  • Stub harness: origin address refocus + bare-address normalisation
  • Stub harness: no-address and empty-emoji paths
  • Manual: SUPER+CTRL+E in Zen address bar inserts (keyboard)
  • Manual: mouse-pick emoji with picker straddling two windows lands in origin
  • Manual: terminal still types without clobbering clipboard

@axelfontaine

Copy link
Copy Markdown
Contributor

#8573 fixes the emoji picker for both Firefox and mouse usage. This one doesn't address the latter.

omarchy-menu-emoji-insert used a clipboard offer plus synthetic
Shift+Insert. That fails in two ways:

- Firefox-based browsers map Shift+Insert to PRIMARY, so a clipboard-only
  offer pastes nothing (issue #10382).
- Chromium/Electron ignore wtype Unicode; terminals need typing, not paste.
- After the fullscreen picker closes, follow_mouse focuses the window under
  the cursor, so mouse-picked emojis land in the wrong window.

Capture the origin window address in Emojis.qml, re-focus it before insert,
type into terminals, and paste with transient clipboard + Ctrl+V elsewhere.

Fixes #10382

Signed-off-by: fresh3nough <anonwurcod@proton.me>
@fresh3nough

Copy link
Copy Markdown
Contributor Author

Thanks for the pointer. You are right that the first revision only covered the Firefox PRIMARY/Shift+Insert mismatch and left the mouse origin-window case alone.

Updated this PR to cover both:

  • Emojis.qml records Hyprland.activeToplevel.address when the picker opens and passes it to the insert helper.
  • omarchy-menu-emoji-insert re-focuses that address after the picker closes (so follow_mouse does not steal focus on mouse selection), types into terminal-tagged windows, and pastes with a transient clipboard + Ctrl+V everywhere else (covers Firefox-based browsers from Emoji picker insert fails in Zen/Firefox: Shift+Insert pastes PRIMARY, not clipboard #10382 as well as Chromium/Electron/GTK/Qt).

bash test/shell.d/emojis-test.sh covers the terminal/GUI split, address normalisation, the refocus loop, and the picker wiring.

Happy to close this in favor of #8573 if that lands first; otherwise this is the same shape of fix on current quattro.

@fresh3nough fresh3nough changed the title Paste emoji with Ctrl+V in Firefox-based browsers Fix emoji picker paste for Firefox and mouse selection Sep 7, 2026
@fresh3nough
fresh3nough force-pushed the fix/10382-emoji-firefox-paste branch from fa9300d to b440327 Compare September 7, 2026 11:14
@axelfontaine

Copy link
Copy Markdown
Contributor

This is now a line for line duplicate of #8573 . I don't know what you are trying to achieve with this. Either way it's a weird new variant of plagiarism. Why not put your energy in fixing new problems, instead of duplicating existing PRs? Strange.

@fresh3nough fresh3nough closed this Sep 7, 2026
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.

Emoji picker insert fails in Zen/Firefox: Shift+Insert pastes PRIMARY, not clipboard

2 participants