Skip to content

The desktop app reacts with any emoji, and on macOS its Edit menu inserts emoji in the composer - #242

Merged
pitis merged 3 commits into
mainfrom
feat/desktop-any-emoji
Nov 28, 2026
Merged

pitis merged 3 commits into
mainfrom
feat/desktop-any-emoji

Conversation

@pitis

@pitis pitis commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

What changed

Any emoji as a reaction. The reaction picker gets a "+" ("More reactions") after the six quick reactions, as in the Mac app's ReactionPicker. It focuses a small field in the picker:

  • macOS: the field is hidden (1 px, transparent, as the Mac app's) and "+" also opens the system's Emoji & Symbols palette (window.show_character_palette()), which types into that field.
  • Windows / Linux: there is no call that opens the system picker, so the field shows, with a hint: "Win + ." on Windows (the emoji panel), "Type an emoji" on Linux (an input method's emoji picker such as IBus's, or a paste). Marked with a shortcut: comment.

The field waits until input stops for 50 ms, then takes what it has. Windows types an emoji one character (code point) at a time, and GPUI's WM_CHAR path reports each as its own change, so reading the field on every change would turn 👍🏽 into 👍 and lose ❤️. If an input method is still composing in the field at that point (marked text), the field is left alone until the composition is committed. Then: if its first character passes is_reaction, it is sent with Hush::react, the same call the quick reactions make (choosing our current reaction again takes it back), and the picker closes. Anything else is cleared and the picker stays open.

is_reaction is ported exactly from MessageActions.isReaction: one grapheme (Swift's count == 1), and either more than one scalar (an emoji-form selector, a skin tone, a ZWJ sequence, a flag, a keycap) or a first scalar with Emoji_Presentation. So "1", "#", "©" and a bare "❤" are turned down. Grapheme splitting and emoji properties come from unicode-segmentation and unicode-properties, which GPUI already depends on (no new crate in Cargo.lock).

Emoji in the composer. On macOS the app now has an Edit menu. AppKit adds its own "Emoji & Symbols" (⌃⌘Space, fn E) to any menu titled "Edit", which is also where the Mac app's item comes from. The palette then types into the focused field, the composer included. I checked this with a small AppKit program (no window) that sets a main menu with an "Edit" submenu built the way GPUI builds it. Even an empty one gets Emoji & Symbols [orderFrontCharacterPalette:] with ⌃⌘Space and fn-E. So the app adds no item of its own: one would show twice. Windows and Linux have no menu bar. Their system pickers (Win + ., an input method's) already type into the focused composer, so nothing changes there.

Note for #229 (Edit menu): this PR adds Menu::new("Edit") with no items. Whichever PR merges second keeps a single Edit menu. Don't add an explicit "Emoji & Symbols" item there, because macOS adds one already.

Why

#230: the desktop app could only react with the six quick reactions, and on macOS it had no way to insert an emoji from the app.

How it was tested

  • Test first: the unit tests a_reaction_is_one_emoji_with_its_skin_tone_or_joined_parts_not_text and the_first_character_given_is_the_reaction_if_it_is_one, and the window test an_emoji_given_after_plus_reacts_as_a_quick_one_and_anything_else_goes. The window test opens a picker, presses "+", then:

    • text: dropped once the wait ends, and the picker stays open;
    • a composition still open when the wait ends: left alone;
    • a composition that commits "😂": reacts;
    • "👍🏽" typed one character at a time through the window's input handler: held until the wait ends, then sent whole.

    A reaction reaches the core through react (an unlinked core refuses it: "Couldn't react"), and the picker closes. All three tests failed against stubs before the code was written. Mutation checks also fail the window test: "+" not focusing the field, no wait, no composing check.

  • Gate, from core/ (CARGO_INCREMENTAL=0): cargo fmt --check passes; cargo clippy --all-targets -q -- -D warnings passes; cargo clippy --all-targets --features hush-desktop/snapshot -q -- -D warnings passes; cargo test --features hush-desktop/snapshot -q passes (desktop 298, core 537 passed, 4 ignored), on the head merged with main (8c3d221).

  • Snapshot: reply-light.png / reply-dark.png (macOS) show the picker with "+" after the six reactions. The field is invisible there, as on the Mac.

  • The Swift leg of make check (xcodebuild) was skipped: nothing in app/ changed.

Not tested here

  • Windows' emoji panel (Win + .) and Linux input methods (IBus emoji and others) typing into the field or the composer. I can't run them on this Mac. The wait and the composing check rest on reading GPUI's Windows (WM_CHAR, WM_IME_COMPOSITION) and Linux input code. The window test covers them, but not with a real input method.
  • The live macOS palette opening from "+", and Edit ▸ Emoji & Symbols showing and working under GPUI's own menu handling (AppKit's item has no target, so it goes to NSApp, not GPUI's delegate). GPUI's test window has no palette, so the call is skipped under cfg(test), and the desktop app isn't linked on this Mac.
  • The non-macOS look of the field: the snapshot renders the macOS build only.

Closes #230

… & Symbols

The reaction picker gets a "+" after the quick reactions. It focuses a field in the picker; on
macOS it also opens the system's emoji palette, which types into it, and on Windows and Linux the
field shows and asks for an emoji (Win + . or an input method's picker). The first character it
gets, if the Mac app's isReaction (ported exactly) accepts it, is sent as the quick ones are; the
rest is dropped, and an input method still composing is left alone.

On macOS an Edit menu: AppKit adds its own Emoji & Symbols (Ctrl-Cmd-Space) to it, as to the Mac
app's, and the palette types into the composer.
…posing in the field is left alone

Windows types an emoji one character (code point) at a time, so the field now waits a moment after
the last change before taking what it was given; the composing check now matters for that wait. The
test covers an input method committing an emoji, an emoji typed in parts, and more single emoji;
comments no longer claim how Windows' panel types, and the test cleans its folder.
@pitis

pitis commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Review (/pr-review-toolkit:review-pr: code-reviewer, pr-test-analyzer, silent-failure-hunter; no Critical findings)

Important: fixed in 3d11ec4

  1. Windows types an emoji one code point at a time, so a pick could be cut short or lost. GPUI's Windows backend sends VK_PACKET text through WM_CHAR, one replace_text_in_range per code point, and the field was read on every change. 👍🏽 would have become 👍, 🇷🇴 a lone 🇷, and ❤️ nothing at all. Fix: the field now waits until input has stopped for 50 ms (SETTLE, the same pattern as the link preview's WAIT), then takes what it holds. The window test types "👍🏽" one character at a time. It is held until the wait ends, then sent whole.
  2. The marked-text check could never fire, and its test step passed without it. gpui-base emits no Change while text is marked. Fix: now that the field is read after a wait, a composition can be in progress when the wait ends, so the check is reachable. It is tested by typing "a" and starting to compose before the wait ends: the text is kept. Without the check, that step fails.
  3. The test never covered an input method committing the emoji, which is the Windows/Linux path. Fix: the window test now composes "joy" and commits "😂", and expects a reaction.
  4. is_reaction had only one single-scalar positive, leaving three of the four match arms untested. Fix: added 👍, 🙏 (modifier bases), 🇦 and 🏽 (components).

Minor: fixed

  • The comments said Windows' emoji panel searches through a composition, which isn't established. They are reworded.
  • The window test left its temp folder behind. It is now removed at the end.
  • The main.rs comment said "(the composer)", but the palette types into whichever field has focus. It now says "the composer, say".
  • The PR body claimed the old test covered the marked-text check. It is corrected.

Declined

  • "unicode-properties isn't GPUI's on macOS." It is: cargo tree -i unicode-properties on macOS shows rustybuzz → usvg → gpui-pre (through gpui-pre-apple). The Cargo.toml comment stays.
  • Simplify cfg!(all(target_os = "macos", not(test))) to cfg!(not(test)). Kept. The macOS part says where the palette exists; the call is a no-op elsewhere.
  • The "+" button itself isn't clicked in the test (it calls more_reactions). Kept. The on_click is one line, and clicking it would need the popover's coordinates.
  • GPUI's validateMenuItem: could disable AppKit's Emoji & Symbols. AppKit's item has a nil target and resolves to NSApp, which implements orderFrontCharacterPalette:, so GPUI's delegate isn't consulted. I can't open the app on screen here, so this is listed under "Not tested here".

For the owner (product decisions, left as they are)

  • is_reaction is an exact port. Like the Mac app's, it accepts any single character made of several scalars: a decomposed "é", or an Indic or Hangul cluster from an input method. Tighten both apps (for example, require the first scalar to be an emoji)?
  • On Windows and Linux the field is visible, and typed text that isn't an emoji disappears without a message. That is the Mac's rule, but there the field is hidden. Keep it?
  • The hint wording in the field: "Win + ." on Windows and "Type an emoji" on Linux.

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.

The desktop app reacts with any emoji and inserts emoji in the composer

1 participant