omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Emoji not sent to clipboard

Open nightdevil00 opened this issue 3 months ago • 2 comments

System details

THinkbook 15p Quattro

What's wrong?

Fix: Emoji picker does not copy selected emoji to clipboard

Problem

Selecting an emoji from the emoji picker (Super+Ctrl+E) does not copy it to the clipboard. The emoji is typed into the focused application via wtype, but it is not available for subsequent paste operations (Ctrl+V).

Root cause

bin/omarchy-menu-emoji-insert runs wl-copy with --foreground and then kills the process after a short delay. Killing the wl-copy process disconnects it from the Wayland compositor, which clears the clipboard content.

wl-copy already forks by default to keep serving paste requests in the background. The --foreground flag prevents that fork, and the kill at the end terminates the only process holding the clipboard.

Fix

bin/omarchy-menu-emoji-insert

 #!/bin/bash
 
 # omarchy:summary=Insert an emoji into the focused application
 # omarchy:group=menu
 # omarchy:args=<emoji>
 # omarchy:hidden=true
 
 emoji="${1:-}"
-copy_pid=""
 
 [[ -n $emoji ]] || exit
 
-printf '%s' "$emoji" | wl-copy --type text/plain --sensitive --foreground &
-copy_pid=$!
+printf '%s' "$emoji" | wl-copy --type text/plain
 
 sleep 0.15
 wtype -M shift -k Insert -m shift 2>/dev/null || true
-sleep 0.2
-
-kill "$copy_pid" 2>/dev/null || true

Removed:

  • --sensitive — hinted the compositor to clear clipboard on client disconnect
  • --foreground — prevented wl-copy from forking to serve paste requests
  • & backgrounding, PID tracking, and kill — the kill disconnected wl-copy from the compositor, clearing the clipboard

wl-copy without --foreground forks a child that keeps the clipboard alive until something else replaces it. The parent exits immediately when stdin EOF is received.

Testing

After applying the fix, open the emoji picker (Super+Ctrl+E), select an emoji, then Ctrl+V into any application. The emoji should appear.

Also verify the clipboard still works after the script exits:

printf '%s' "😀" | wl-copy --type text/plain
sleep 0.5
wl-paste  # should print 😀
sleep 2
wl-paste  # should still print 😀

nightdevil00 avatar Aug 17 '26 07:08 nightdevil00

Facing the same issue on fresh install of Omarchy quattro. System Specs: AMD Ryzen 5 5500, GTX 1660 Super, 16 GB of RAM

nafeesrakib22 avatar Sep 05 '26 06:09 nafeesrakib22

I read this against current quattro (902fd8aeb). Your description of the mechanism is right: bin/omarchy-menu-emoji-insert puts the emoji on the clipboard with wl-copy --foreground, pastes it with Shift+Insert, then kills that wl-copy after 0.2s, so nothing is left to paste afterwards.

That is the intended behaviour, though, not a regression. The helper was added in cd2be9da2 ("Insert emojis without persisting clipboard entries") and adjusted in 6f0d9d53c ("Keep sensitive clipboard contents out of history"): the picker inserts the emoji without replacing what you had copied before, and without adding it to clipboard history. test/shell.d/emojis-test.sh checks for exactly these flags.

One correction to the diagnosis: --sensitive doesn't make the compositor clear anything. It sets the password-manager hint that shell/plugins/clipboard/capture.sh uses to keep an entry out of clipboard history. The kill is what ends the clipboard entry. So the proposed patch would do two things: keep the emoji on the clipboard, which overwrites whatever was there, and record every picked emoji in clipboard history. Whether the picker should work that way is a product decision, so I haven't opened a fix. Nothing was run on a worker, because the code and its history already show this is the intended behaviour. #7378 reports the same thing.

The second opinion (Codex Medium) read the same code and history independently and agreed: the behaviour is intended, and the --sensitive explanation is inaccurate. Independence isn't guaranteed, because it may have read my reasoning.

This is waiting on the maintainer to decide whether picked emojis should stay on the clipboard.

omarchybot avatar Oct 08 '26 07:10 omarchybot