Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
56 lines
2.2 KiB
Go
56 lines
2.2 KiB
Go
package accelerator
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// Keysym returns the XKB (and X11) name of the key, as in "a", "comma",
|
|
// "Return", "F5" or "KP_Add".
|
|
func (a Accelerator) Keysym() string {
|
|
if name, ok := keysyms[a.Key]; ok {
|
|
return name
|
|
}
|
|
if strings.HasPrefix(a.Key, "Num") && len(a.Key) == 4 {
|
|
return "KP_" + a.Key[3:]
|
|
}
|
|
if r := []rune(a.Key); len(r) == 1 && r[0] > '~' {
|
|
return fmt.Sprintf("U%04X", r[0])
|
|
}
|
|
return a.Key // letters, digits and F1-F24
|
|
}
|
|
|
|
// XDGTrigger formats the accelerator as a trigger of the XDG shortcuts
|
|
// specification, as in "CTRL+SHIFT+k", which desktop portals take.
|
|
func (a Accelerator) XDGTrigger() string {
|
|
var parts []string
|
|
for _, m := range []struct {
|
|
mod Modifiers
|
|
name string
|
|
}{{Ctrl, "CTRL"}, {Alt, "ALT"}, {Shift, "SHIFT"}, {Super, "LOGO"}} {
|
|
if a.Has(m.mod) {
|
|
parts = append(parts, m.name)
|
|
}
|
|
}
|
|
return strings.Join(append(parts, a.Keysym()), "+")
|
|
}
|
|
|
|
var keysyms = map[string]string{
|
|
"!": "exclam", `"`: "quotedbl", "#": "numbersign", "$": "dollar", "%": "percent",
|
|
"&": "ampersand", "'": "apostrophe", "(": "parenleft", ")": "parenright", "*": "asterisk",
|
|
"+": "plus", ",": "comma", "-": "minus", ".": "period", "/": "slash", ":": "colon",
|
|
";": "semicolon", "<": "less", "=": "equal", ">": "greater", "?": "question", "@": "at",
|
|
"[": "bracketleft", `\`: "backslash", "]": "bracketright", "^": "asciicircum",
|
|
"_": "underscore", "`": "grave", "{": "braceleft", "|": "bar", "}": "braceright", "~": "asciitilde",
|
|
"Enter": "Return", "Tab": "Tab", "Space": "space", "Backspace": "BackSpace",
|
|
"Delete": "Delete", "Insert": "Insert", "Escape": "Escape",
|
|
"Up": "Up", "Down": "Down", "Left": "Left", "Right": "Right",
|
|
"Home": "Home", "End": "End", "PageUp": "Page_Up", "PageDown": "Page_Down",
|
|
"VolumeUp": "XF86AudioRaiseVolume", "VolumeDown": "XF86AudioLowerVolume", "VolumeMute": "XF86AudioMute",
|
|
"MediaNextTrack": "XF86AudioNext", "MediaPreviousTrack": "XF86AudioPrev",
|
|
"MediaStop": "XF86AudioStop", "MediaPlayPause": "XF86AudioPlay",
|
|
"PrintScreen": "Print", "CapsLock": "Caps_Lock", "NumLock": "Num_Lock", "ScrollLock": "Scroll_Lock",
|
|
"NumDec": "KP_Decimal", "NumAdd": "KP_Add", "NumSub": "KP_Subtract",
|
|
"NumMult": "KP_Multiply", "NumDiv": "KP_Divide",
|
|
}
|