39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
// Fenrir console screen reader.
|
|
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package app
|
|
|
|
import (
|
|
"git.stormux.org/storm/fenrir/internal/emoji"
|
|
"git.stormux.org/storm/fenrir/internal/i18n"
|
|
"git.stormux.org/storm/fenrir/internal/interaction"
|
|
"git.stormux.org/storm/fenrir/internal/presentation"
|
|
)
|
|
|
|
func (ui *internalUI) open_emoji(clipboards *clipboardHost) {
|
|
session, err := emoji.New_session()
|
|
if err != nil {
|
|
ui.failed("Could not open Emoji Menu: {0}", err)
|
|
return
|
|
}
|
|
if _, err := ui.begin(emoji.MenuTitle); err != nil {
|
|
ui.failed("Could not open Emoji Menu: {0}", err)
|
|
return
|
|
}
|
|
ui.configure_session(session)
|
|
ui.session = session
|
|
ui.action = func(action string, session *interaction.Session) {
|
|
if action != "copy_emoji" {
|
|
return
|
|
}
|
|
value, label, ok := emoji.Selection(session)
|
|
if !ok || !clipboards.add(value, true) {
|
|
return
|
|
}
|
|
ui.close()
|
|
clipboards.present(i18n.Format("Added {0} to clipboard", i18n.T(label)), presentation.CopyToClipboard)
|
|
}
|
|
ui.voice.Say(session.Open())
|
|
}
|