Introducing a new way to review your PRs.

Read the announcement

crmne / zapfast

ZapFast: a fast, native WhatsApp client in Rust and egui

View on GitHub

19 documents · Updated Nov 18, 2026

docs / stickers-and-emoji

Stickers and emoji

ZapFast gives chats one picker for emoji and stickers. Emoji help users add text or reactions, while stickers form a searchable local library that can sync with the phone, accept outside packs, and turn pictures into sendable stickers. The system keeps the picker responsive by loading pictures in the background and by limiting requests to the sticker service.

Picker surface

The picker is the main user interface for emoji and stickers. It connects selection with composer input, reactions, sticker shelves, pack actions, and sending.

Emoji selection

The emoji picker shows recent emoji followed by Unicode groups such as Smileys & Emotion, People & Body, and Flags. Search matches emoji names and shortcodes, and the same grid also serves message reactions with a separate frequently used list. Selecting an emoji inserts it into the composer or applies it to the selected message. Recent composer emoji are stored in settings with newest use first and keep up to 36 entries; the open picker keeps its own view so repeated selections do not move the grid under the user.

The first visible page is prepared before the picker draws. This keeps the category icons, recent emoji, and the first group available without making the interface wait for each new color glyph.

References: src/…/picker.rs• L177-217 src/…/picker.rs• L239-267 src/…/picker.rs• L392-413 src/app.rs• L8669-8695 src/app.rs• L8753-8773 src/app.rs• L11605-11610

Sticker shelves

The sticker tab groups stickers into Recent, Favorites, Received, named packs, and an Add page. Recent represents stickers used on the phone or sent from ZapFast, Favorites are reusable stickers synced with the phone, and Received holds reusable stickers from chats that are not already in the other collections. Clicking a tile sends it; context actions save it, remove it from Recent or Favorites, or file it into a local pack.

The picker can also preview animated stickers. It uses a still view until an animated tile is visible and hovered, which keeps large shelves usable without decoding every animation at once.

References: src/…/picker.rs• L1199-1312 src/…/picker.rs• L1371-1467 src/…/picker.rs• L1704-1827 src/…/stickers.rs• L320-398

Sticker discovery

Sticker discovery combines the picker shelves with metadata stored in each sticker file. This lets a user search the stickers already available on the computer instead of searching a remote catalog.

Sticker search accepts an emoji, a word that names an emoji, or part of a pack name. A multi-word query requires every term to match the sticker's emoji tags; emoji presentation variants compare as the same emoji. Results are de-duplicated and favor Favorites and Recent before pack stickers and Received stickers. A pack-name match adds the whole pack.

Search depends on each sticker's emoji metadata. The worker reads that metadata once per file version and supplies it to the picker, so changing a sticker file causes its search data to be read again.

References: src/sticker_search.rs• L1-5 src/sticker_search.rs• L12-36 src/sticker_search.rs• L39-105 src/…/stickers.rs• L402-426 src/…/picker.rs• L1314-1369

Sticker metadata

Sticker metadata preserves the link between a picture and the meaning it expresses. ZapFast reads and writes the WhatsApp JSON object carried in a WebP EXIF chunk. The object can name the pack, publisher, and associated emoji, and the emoji tags drive both sticker suggestions and local search.

When ZapFast creates or imports a sticker, it keeps the tags in the file so the association survives storage, sending, and later indexing. Text and duplicate emoji are removed from user-entered tags before they are written.

References: src/sticker_meta.rs• L1-7 src/sticker_meta.rs• L14-37 src/sticker_meta.rs• L70-99 src/sticker_meta.rs• L194-241 src/app.rs• L8868-8878

Sticker acquisition

The system supports both packs brought into ZapFast and stickers made from local pictures. Both paths end with WebP sticker files that can appear in shelves, carry emoji metadata, and be sent or saved.

Pack import

The Add page accepts a Signal sticker link or a .wastickers archive. A Signal link identifies an encrypted pack; ZapFast verifies and decrypts the pack data, reads its title and emoji labels, and downloads its sticker files. An archive supplies its title when available and ignores its tray image. Imported images become WebP files, while animated APNG and GIF input keeps its motion.

Imported packs are placed in a new named directory. Name collisions create another directory instead of merging two packs, so an import cannot silently change an existing pack.

References: src/…/picker.rs• L1500-1556 src/…/picker.rs• L1605-1673 src/…/sticker_import.rs• L1-3 src/…/sticker_import.rs• L229-329 src/…/sticker_import.rs• L332-394 src/…/sticker_import.rs• L462-547

Sticker creation

Sticker creation starts with a local picture selected from the Add page. The user chooses a square crop, decides whether transparent areas remain transparent, and supplies emoji tags. ZapFast scales the result to the WhatsApp sticker size, encodes it as a still WebP, and lowers quality when needed to meet the still-sticker size limit.

The result can be sent at once or saved as a favorite. A local pack can also be created first, then filled with stickers from the picker. Local pack membership uses sticker content rather than the source path, so the same picture remains one member even when it appears in several shelves.

References: src/…/sticker_maker.rs• L1-10 src/…/sticker_maker.rs• L21-66 src/…/worker.rs• L7972-8043 src/…/picker.rs• L1500-1603 src/…/sticker_store.rs• L128-170

Sticker storage and sync

Sticker state is split between user data, a download cache, and the archive's sync records. This split protects saved collections from cache cleanup while allowing missing chat media to be downloaded again.

Local sticker storage

On Linux, account sticker data lives under ~/.local/state/zapfast/accounts/<id>/stickers/, while downloaded recent and chat sticker files use the account cache under ~/.cache/zapfast/accounts/<id>/stickers/. Saved stickers use their content hash as the filename, and packs use directories of WebP files. Local packs also have a manifest that keeps the pack name, creation order, and member order.

The content hash is the stable identity of a sticker across Recent, Favorites, packs, chat copies, and the phone's file hash. This prevents duplicate saved files and lets a local pack refer to the picture itself rather than to one temporary copy.

References: src/paths.rs• L263-271 docs/…/settings-and-files.md• L7-23 src/…/sticker_store.rs• L1-9 src/…/sticker_store.rs• L17-33 src/…/sticker_store.rs• L44-50 src/…/sticker_store.rs• L172-197

Phone synchronization

Favorites and Recent have different sync rules. A favorite change records its content hash, time, and any known download reference before it is sent to the phone; if no usable reference exists, ZapFast uploads the local sticker first. A favorite received from the phone is copied from any matching local sticker before ZapFast uses the network.

Removing a Recent sticker records the removal time. Older uses stay hidden, but a later send of the same sticker makes it recent again. The archive keeps these rules and the favorite delivery state so changes survive reconnects and can be replayed after linking.

References: src/…/stickers.rs• L1-11 src/…/stickers.rs• L43-65 src/…/stickers.rs• L68-127 src/…/stickers.rs• L257-300 src/…/stickers.rs• L429-502 src/…/stickers.rs• L630-689

Sticker prefetch and pacing

Opening the sticker tab starts recovery of missing Recent and chat stickers so the shelves can show the phone's collections. The worker treats recent-phone downloads, picker chat downloads, and missing favorite downloads as background work rather than as part of drawing the picker.

The following flow shows how a missing sticker moves from a shelf request to a paced local result.

flowchart LR
    A[Open sticker picker or receive sync] --> B[Find missing sticker files]
    B --> C{Pacing window open?}
    C -- No --> D[Wait for resume time]
    D --> C
    C -- Yes --> E[Start limited downloads]
    E --> F{Download result}
    F -- Success --> G[Record local path and refresh shelves]
    F -- Rate limited --> H[Pause all sticker downloads]
    H --> D
    F -- Gone --> I[Rest the item before retry]
    F -- Other failure --> J[Skip for this session or retry later]

Download pacing

The pacing layer keeps at most two picker-related sticker downloads in flight. Favorite downloads start at most two per worker tick, and recent and chat sticker downloads share the same in-flight limit. A rate-limit response pauses all sticker work for 30 seconds; repeated responses during the pause double the wait up to 15 minutes. A file reported as gone rests for one week instead of consuming requests on every connection.

The shelves do not rebuild after every arrival. They refresh after a small batch or when the current batch ends, which keeps a paced backlog from constantly moving the open picker. A failed automatic chat download is skipped for the session, but a direct user click can retry it through the normal message download path.

References: src/…/sticker_pace.rs• L1-21 src/…/sticker_pace.rs• L31-85 src/…/worker.rs• L10482-10569 src/…/worker.rs• L10572-10649 src/…/stickers.rs• L800-895

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the emoji tags written into WebP files aligned with the search index and with the metadata sent in a sticker pack.
  • Keep content-hash naming aligned with phone filehash conversion, favorite sync, Recent removal, and local pack membership.
  • Keep the shared sticker download limit applied to both phone Recent files and chat files; changing one queue alone can restore request bursts.
  • Keep imported pack order and emoji labels aligned when archive formats or WhatsApp pack message fields change.
  • Keep cache paths separate from saved sticker paths so cache cleanup does not remove Favorites or local packs.

Important failure modes

TriggerConsequenceGuard
A sticker has no usable emoji metadataEmoji and word search cannot find itPreserve or add metadata when importing or creating WebP files
The phone reports a favorite but its file is missing and no local copy existsThe favorite stays listed but cannot be displayed until a fetch succeedsRetain CDN references and queue the fetch for a connected account
Sticker requests receive a rate-limit responseSticker loading pauses and can delay other media workShare the in-flight limit and back off from 30 seconds up to 15 minutes
A pack import contains no readable sticker filesNo pack is createdReject the import rather than creating an empty imported pack
A local pack is changed through a non-local or outside directoryPack contents could diverge from the supported pack modelAllow membership changes only for local packs under the account pack root
A still sticker remains over WhatsApp's size limit after encodingThe phone may reject the stickerRetry encoding at lower quality before producing the file

Key files

FileWhy to read it
src/…/picker.rsMain emoji and sticker picker flow, shelves, search entry, import controls, pack creation, and tile actions
src/sticker_search.rsSearch contract across emoji tags, emoji names, pack names, and shelf priority
src/sticker_meta.rsWebP metadata contract that connects emoji tags, packs, imports, and sending
src/…/sticker_import.rsSignal and archive import flow plus image conversion and animation retention
src/…/sticker_maker.rsPicture-to-sticker rules for crop, transparency, size, encoding, and metadata
src/…/sticker_store.rsContent-hash storage, local pack manifests, and saved sticker files
src/…/stickers.rsPhone sync, favorites, Received and Recent shelves, pack sharing, and missing-file recovery
src/…/sticker_pace.rsShared queue limits and backoff behavior for sticker downloads
src/…/stickers.rsDurable Recent-removal and favorite-sync state
src/emoji.rsEmoji font setup, rendering, and picker prewarming