Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the emoji picker to refocus the window that was active when the picker opened, ensuring emoji insertion lands in the intended application (especially in split/multi-monitor layouts).
Changes:
- Capture the active Hyprland window address on picker open and pass it to the insert helper.
- Refocus the captured window in
omarchy-menu-emoji-insertbefore pasting. - Extend shell tests with a
hyprctlstub and focus-restore assertions.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| test/shell.d/emojis-test.sh | Adds a hyprctl stub and validates focus-restore behavior in the helper script. |
| shell/plugins/emojis/Emojis.qml | Captures Hyprland active window address on open and passes it to the insert helper. |
| bin/omarchy-menu-emoji-insert | Accepts optional focus address and refocuses via hyprctl before typing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| cat >"$TMPDIR/bin/hyprctl" <<'SH' | ||
| #!/bin/bash | ||
| printf '%s\n' "$*" >>"$HYPRCTL_OUT" | ||
| SH |
There was a problem hiding this comment.
Addressed in the amended head: the first invocation now sets HYPRCTL_OUT="$TMPDIR/hyprctl", so the guard assertion has teeth (same fix flagged by the human reviewer).
| chmod +x "$TMPDIR/bin/wl-copy" "$TMPDIR/bin/wtype" "$TMPDIR/bin/sleep" | ||
| chmod +x "$TMPDIR/bin/wl-copy" "$TMPDIR/bin/wtype" "$TMPDIR/bin/hyprctl" "$TMPDIR/bin/sleep" | ||
|
|
||
| WL_COPY_OUT="$TMPDIR/copy" WL_COPY_EMOJI_OUT="$TMPDIR/emoji" WTYPE_OUT="$TMPDIR/wtype" PATH="$TMPDIR/bin:$PATH" \ |
There was a problem hiding this comment.
Addressed in the amended head: the first invocation now sets HYPRCTL_OUT="$TMPDIR/hyprctl", so the guard assertion has teeth (same fix flagged by the human reviewer).
|
|
||
| # With a focus address, the helper restores that window's focus before pasting. | ||
| # No hyprctl call is expected without one, so the stub stays empty here. | ||
| [[ ! -s "$TMPDIR/hyprctl" ]] || fail "emoji insert helper skips focus restore without a focus address" |
There was a problem hiding this comment.
Addressed in the amended head: the first invocation now sets HYPRCTL_OUT="$TMPDIR/hyprctl", so the guard assertion has teeth (same fix flagged by the human reviewer).
| } | ||
|
|
||
| function captureFocus() { | ||
| focusProbe.command = ["/usr/bin/hyprctl", "-j", "activewindow"] |
There was a problem hiding this comment.
Fixed in 03a0d2d: the probe now invokes hyprctl via PATH, consistent with the rest of the shell (e.g. Workspaces.qml runs hyprctl dispatch … the same way).
| function applySelected(emoji) { | ||
| if (!emoji) return | ||
| root.dismiss() | ||
| Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-menu-emoji-insert", emoji]) | ||
| Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-menu-emoji-insert", emoji, root.focusAddress]) | ||
| } |
There was a problem hiding this comment.
Rationale for keeping this as-is: captureFocus() now starts the probe before the overlay maps (it runs first thing in open()), so by the time the grid is visible and a user can physically click a cell (hundreds of ms later), the probe has long finished — the race is not humanly reachable. And if the probe ever yields nothing (hyprctl unavailable), the insert helper's own focus dispatch would fail identically, so the empty-address path degrades to exactly the pre-fix behavior. Queuing the emoji would add state for a case that cannot occur in practice.
80417e3 to
83d5b06
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
shell/plugins/emojis/Emojis.qml:65
- Hard-coding
/usr/bin/hyprctlreduces portability (systems wherehyprctlis elsewhere, e.g.,/run/current-system/sw/bin, or sandboxed environments). Prefer invokinghyprctlvia PATH (e.g.,\"hyprctl\") or making the binary path configurable so focus capture works across supported deployments.
focusProbe.command = ["/usr/bin/hyprctl", "-j", "activewindow"]
The picker overlay closes before the insert helper runs, and the compositor then refocuses whichever window sits under the clicked cell. When the card spans two windows (split layout, multi-monitor), the paste lands in that window instead of the one the user was in. Capture the active window address when the picker opens and have the insert helper restore focus to it before pasting. The helper keeps its existing behavior when called without a focus address.
83d5b06 to
03a0d2d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
test/shell.d/emojis-test.sh:106
- This assertion is brittle because the helper explicitly has a fallback path (
... || hyprctl dispatch focuswindow ...). If the primary focus-restore command fails in real environments (which is plausible), the helper will execute an additionalhyprctlcall and the stub file will contain multiple lines, causing this test to fail even though behavior is correct. Consider either (a) asserting that the log contains at least one acceptable focus-restore command, or (b) splitting into two tests: one where the stub simulates success for the primary call and one where it simulates failure and verifies the fallback invocation.
[[ $(<"$TMPDIR/hyprctl") == 'dispatch hl.dsp.focus({ window = "address:0x1234abcd" })' ]] \
|| fail "emoji insert helper restores the focus captured at picker open"
|
Thanks for the detailed report and fix. I ran this on a worker VM built from the Omarchy ISO. Current What I ran. I opened two foot terminals tiled side by side, focused the left one and opened the emoji picker. Then I clicked emojis on the half of the card over the right terminal with a real (uinput) pointer. Each terminal wrote what it received to a file, so the check was which file the emoji landed in.
Why it went away. Your diagnosis was right for the code you wrote against. When the overlay unmapped, Hyprland's Second opinion. Codex Medium reviewed the diff read-only. It agreed this is the proportionate fix for #7350, compared with #8573, which fixes the same issue but also changes how emojis are inserted. Its independence is not guaranteed. It flagged one defect in this PR:
This is now waiting on the maintainer. My recommendation is to close it, and #7350 with it, as fixed by 48de782. It would only be worth keeping as a guard if overlays go back to unmapping on close. |
|
Thank you for this, @Guts444, and for the diagnosis, which was right. 48de782 (#13419) keeps the overlay mapped and hands focus back where it was, and a worker run confirmed the emoji now lands in the window you were typing in on current Closed at the maintainer's request. The review above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent. |
Summary
Fixes #7350 — the emoji picker types the picked emoji into the wrong window whenever the picker card visually spans two windows (split layouts, side-by-side monitors).
Root cause:
Emojis.qml'sapplySelected()dismisses the overlay and then runsbin/omarchy-menu-emoji-insert, which pastes withwtype Shift+Insertinto whatever window is focused at that moment. Once the overlay closes, the compositor refocuses whichever window sits under the clicked cell — so clicking an emoji on the half of the card over the other window pastes it there (e.g. into a browser's address bar) instead of in the window the user was typing in.Fix:
shell/plugins/emojis/Emojis.qml— when the picker opens, capture the address of the active window (hyprctl -j activewindow, via a one-shotProcess), and pass it to the insert helper alongside the emoji.bin/omarchy-menu-emoji-insert— accept an optional second argument (focus address) and dispatch focus back to that window (hl.dsp.focus({ window = "address:…" }), the same form already used inWorkspaces.qml) before pasting. With no address given, behavior is unchanged, so the command stays usable standalone.test/shell.d/emojis-test.sh— new coverage: the helper skips the focus restore when called without an address, and issues the correct dispatch when given one.Related
I did not touch the clipboard lifecycle (the
wl-copy --foreground+killdance). That is deliberate: git history shows the transient clipboard is intentional (Insert emojis without persisting clipboard entries,Keep sensitive clipboard contents out of history), even though it confuses users who expect the emoji to remain pasteable after insert (#7233). Happy to address that separately if the maintainers want to reconsider.Test plan
test/all— all emoji tests pass; the only failures (config-test,snapper-test,unowned-system-paths-test) also fail on a cleanquattrocheckout on this machine (environment-specific, unrelated).