Emoji picker (Super+.): search, tabs, skin tones, recents, text-input-v3 insertion
CI / test (push) Canceled after 0s
CI / test (push) Canceled after 0s
Compositor-drawn Win+. style picker. The focused app keeps keyboard focus so
its text-input-v3 field stays enabled; the emoji goes in with commit_string,
or onto the clipboard with a visible notice when the app has no text field.
Shortcut lives in the shortcut table (rebindable in Settings > Shortcuts).
- compositor/wayland/text_input.mbt: zwp_text_input_manager_v3 (global 12)
- compositor/emoji: Emoji 18.0 + CLDR 49 data (Unicode License), search,
picker model, CBDT/CBLC + GSUB reader for Noto Color Emoji
- Chandra's own pinned bitmap Noto Color Emoji (scripts/fetch-emoji-font.sh,
just emoji-font); Fedora's COLRv1 copy can't be drawn. Missing font shows
an error panel.
- raster WIT: emoji-font, emoji-has, emoji-image; served by wasmhost
- state.edn :emoji {:recent [...] :skin-tone n}
- tests incl. a fake text-input client; docs/emoji-picker.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hkABDGJixotaqFv2X2
This commit is contained in:
39 files changed
+4942
-41
No files matched your search
@@ -21,8 +21,11 @@
|
||||
/// :restore-session false ; don't reopen them (absent: reopen); the session settings module
|
||||
/// ; or a hand edit sets it
|
||||
/// :remember-windows false ; don't place windows where they were left (absent: do)
|
||||
/// :auth-agent :system} ; passwords for run0/pkexec/polkit go to the system's polkit
|
||||
/// :auth-agent :system ; passwords for run0/pkexec/polkit go to the system's polkit
|
||||
/// ; agent instead of Chandra's own dialog (absent: :chandra)
|
||||
/// :emoji {:recent ["👍🏽" "🍕"] :skin-tone 3}}
|
||||
/// ; the emoji picker's recently used emoji (newest first, as
|
||||
/// ; inserted) and skin tone, 0 default .. 5 dark (emoji_picker.mbt)
|
||||
///
|
||||
/// Saving merges into what is already in the file, so keys this build doesn't know (a future
|
||||
/// widget's state, hand-written notes) survive. Everything is a no-op unless `persist` is on
|
||||
@@ -577,6 +580,67 @@ pub fn DesktopShell::save_session(self : DesktopShell, session : Array[SessionEn
|
||||
write_state_file(entries)
|
||||
}
|
||||
|
||||
///| The emoji picker's saved state: recent emoji (newest first) and skin tone (0-5). Empty and 0
|
||||
/// without `persist` or when state.edn doesn't say.
|
||||
pub fn DesktopShell::load_emoji(self : DesktopShell) -> (Array[String], Int) {
|
||||
if !self.persist {
|
||||
return ([], 0)
|
||||
}
|
||||
let recent : Array[String] = []
|
||||
let mut tone = 0
|
||||
match lookup_key(read_state_file(), "emoji") {
|
||||
Some(Mapping(m)) => {
|
||||
match lookup_key(m, "recent") {
|
||||
Some(Vector(vs)) =>
|
||||
for v in vs {
|
||||
match v {
|
||||
Text(t) => recent.push(t)
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
match lookup_key(m, "skin-tone") {
|
||||
Some(Integer(n)) =>
|
||||
match parse_int_str(n) {
|
||||
Some(t) if t >= 0 && t <= 5 => tone = t
|
||||
_ => ()
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
(recent, tone)
|
||||
}
|
||||
|
||||
///| Write the emoji picker's recent emoji and skin tone as `:emoji`, keeping every other key.
|
||||
/// A no-op without `persist`.
|
||||
pub fn DesktopShell::save_emoji(self : DesktopShell, recent : Array[String], tone : Int) -> Unit {
|
||||
if !self.persist {
|
||||
return
|
||||
}
|
||||
let value = @edn.Value::Mapping([
|
||||
(@edn.Value::Keyword("recent"), @edn.Value::Vector(recent.map(r => @edn.Value::Text(r)))),
|
||||
(@edn.Value::Keyword("skin-tone"), @edn.Value::Integer(tone.to_string())),
|
||||
])
|
||||
let entries : Array[(@edn.Value, @edn.Value)] = []
|
||||
let mut placed = false
|
||||
for e in read_state_file() {
|
||||
match e.0 {
|
||||
Keyword("emoji") => {
|
||||
entries.push((e.0, value))
|
||||
placed = true
|
||||
}
|
||||
_ => entries.push(e)
|
||||
}
|
||||
}
|
||||
if !placed {
|
||||
entries.push((@edn.Value::Keyword("emoji"), value))
|
||||
}
|
||||
write_state_file(entries)
|
||||
}
|
||||
|
||||
///| Start the app whose windows carry `app_id` (see `resolve_app_id`), without counting it as
|
||||
/// a recent launch. False when no installed app matches or it could not be started.
|
||||
pub fn DesktopShell::launch_app_id(self : DesktopShell, app_id : String) -> Bool {
|
||||
|
||||
Reference in new issue
Block a user