config

package
v1.0.260758 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HKQuit            = "quit"
	HKFind            = "find"
	HKFindAlt         = "find_alt"
	HKFindLegacy      = "find_legacy"
	HKStartMenu       = "start_menu"
	HKStartMenuAlt    = "start_menu_alt"
	HKStartMenuLegacy = "start_menu_legacy"
	HKClose           = "close"
	HKMinimize        = "minimize"
	HKCopy            = "copy"
	HKPaste           = "paste"
	HKCopyMode        = "copy_mode"
	HKCycleFocus      = "cycle_focus"
	HKPalette         = "palette"
	HKPaletteAlt      = "palette_alt"
)

Hotkey action IDs (keys in Hotkeys map).

View Source
const (
	MenuPrograms = "programs"
	MenuSystem   = "system"
)

Menu folder for Start menu placement.

View Source
const (
	ThemeXP      = "XP"
	ThemeScarlet = "Scarlet"
	ThemeBumble  = "Bumble"
	ThemeBubble  = "Bubble"
	ThemeSprout  = "Sprout"
)

Theme pack IDs / display names.

View Source
const MinScrollback = 1000

MinScrollback is the smallest scrollback depth (in lines) any terminal window is allowed to have, regardless of what a user config requests.

Variables

This section is empty.

Functions

func BuiltinProgramIcons

func BuiltinProgramIcons() []string

BuiltinProgramIcons are reserved by first-party Start menu entries.

func DefaultAssociations

func DefaultAssociations() map[string]string

DefaultAssociations maps file extensions (no dot) to launch actions. role:editor / role:image expand via Roles.

func DefaultHotkeys

func DefaultHotkeys() map[string]string

DefaultHotkeys are Desk-level bindings (not forwarded into PTYs when matched).

func ExtOf

func ExtOf(path string) string

ExtOf returns the lowercase extension without dot (last suffix).

func FormatMissingAssoc

func FormatMissingAssoc(path string) string

FormatMissingAssoc is the user-facing notify body for unknown types.

func HotkeyActions

func HotkeyActions() []string

HotkeyActions is the Settings order.

func HotkeyLabel

func HotkeyLabel(action string) string

HotkeyLabel is a human label for Settings.

func IconPalette

func IconPalette() []string

IconPalette is the selectable emoji pool for Add Program.

func OverSSH

func OverSSH() bool

OverSSH reports whether we appear to be running inside an SSH session.

func Path

func Path() string

func ProgramAction

func ProgramAction(id string) string

ProgramAction returns the LaunchAction string for a custom program.

func Save

func Save(cfg Config) error

Types

type AppSource

type AppSource struct {
	Repo    string `json:"repo"`              // "owner/repo"
	Branch  string `json:"branch,omitempty"`  // defaults to "main" if empty
	Trusted bool   `json:"trusted,omitempty"` // install scripts run unsandboxed; App Store warns once per untrusted source, then persists this
}

AppSource is a catalog repo the App Store fetches index.json from.

type AudioStreamCfg

type AudioStreamCfg struct {
	Enabled bool `json:"enabled"`
	Mute    bool `json:"mute"` // checked live per chunk — takes effect without reattaching
}

AudioStreamCfg is Settings → Audio streaming: stream the host's current audio output (desktop sounds, Amp, Vid, a bridged app — whatever's already playing) to an attached remote client (-attach) over the same socket -listen already uses, instead of only being audible on the host. No bitrate control: this ships raw PCM, not an encoded codec (see docs/audio-stream.md's own phasing — Opus was explicitly "pick later"), so there's nothing to trade off yet.

type CalendarAccount

type CalendarAccount struct {
	Provider string `json:"provider"` // "google" | "microsoft"
	Enabled  bool   `json:"enabled"`
	ClientID string `json:"client_id"`
}

CalendarAccount is one opt-in OAuth2 calendar connection. ClientID is the user's own OAuth app (Google Cloud Console / Azure Portal) — there is no ttypedesk-wide client ID, see internal/calsync's package doc. Nothing here is a secret; the token itself lives in internal/credstore, never in this file.

type CalendarCfg

type CalendarCfg struct {
	Accounts []CalendarAccount `json:"accounts"`
	LeadMin  int               `json:"lead_min"`
	Timezone string            `json:"timezone"`
}

CalendarCfg is Settings → Calendar: accounts, reminder lead time, and an optional timezone override (empty = local system timezone).

type Config

type Config struct {
	FPS                 int               `json:"fps"`
	SSHFPS              int               `json:"ssh_fps"`
	Shell               string            `json:"shell"`
	Scrollback          int               `json:"scrollback"`
	ShowDesktopIcons    bool              `json:"show_desktop_icons"`
	SolidDesktopOnSSH   bool              `json:"solid_desktop_on_ssh"`
	RestoreSession      bool              `json:"restore_session"`
	OpenTerminalOnStart bool              `json:"open_terminal_on_start"`
	Autostart           []string          `json:"autostart"` // LaunchAction strings after session restore
	Theme               Theme             `json:"theme"`
	Taskbar             TaskbarCfg        `json:"taskbar"`
	DesktopIcons        []DesktopIcon     `json:"desktop_icons"`
	Programs            []Program         `json:"programs"`
	Roles               Roles             `json:"roles"`
	Associations        map[string]string `json:"associations"`
	Files               FilesCfg          `json:"files"`
	Wallpaper           Wallpaper         `json:"wallpaper"`
	Notify              NotifyCfg         `json:"notify"`
	Hotkeys             map[string]string `json:"hotkeys"`
	Palette             PaletteCfg        `json:"palette"`
	Recipes             []Recipe          `json:"recipes"`
	AppSources          []AppSource       `json:"app_sources"`
	Calendar            CalendarCfg       `json:"calendar"`
	AudioStream         AudioStreamCfg    `json:"audio_stream"`
}

Config is the application configuration.

func Default

func Default() Config

func Load

func Load() (Config, error)

func (*Config) ApplyThemePack

func (c *Config) ApplyThemePack(idOrName string) bool

ApplyThemePack sets chrome colors and wallpaper for a pack.

func (*Config) ApplyXPTheme

func (c *Config) ApplyXPTheme()

ApplyXPTheme sets XP chrome colors and Bliss wallpaper (image/cover).

func (Config) AvailableIcons

func (c Config) AvailableIcons() []string

AvailableIcons returns palette entries not in UsedIcons.

func (Config) EffectiveFPS

func (c Config) EffectiveFPS() int

EffectiveFPS returns the frame rate to use (env override > ssh/local defaults).

func (Config) ExpandLaunch

func (c Config) ExpandLaunch(action string) string

ExpandLaunch resolves role:name and {terminal}/{editor}/{browser}/{filemgr}/{image} placeholders in a LaunchAction string. Returns "" if a required role is unset (e.g. role:browser with no Roles.Browser).

func (Config) FindProgram

func (c Config) FindProgram(id string) *Program

FindProgram returns a program by id.

func (Config) OpenAction

func (c Config) OpenAction(path string) (action string, ok bool)

OpenAction returns the launch action for a file path. ok=false means no association (caller should notify). Directories are not handled here — callers navigate in Files.

func (*Config) RemoveProgram

func (c *Config) RemoveProgram(id string) bool

RemoveProgram deletes a custom program by id and syncs desktop shortcuts.

func (Config) ResolveHotkey

func (c Config) ResolveHotkey(action string) string

ResolveHotkey returns the binding for action, or default if unset.

func (Config) ResolveRole

func (c Config) ResolveRole(name string) string

ResolveRole expands role:name using Roles; unknown roles return empty.

func (*Config) SyncProgramDesktop

func (c *Config) SyncProgramDesktop()

SyncProgramDesktop ensures DesktopIcons matches Program.Desktop flags.

func (Config) TaskbarDock

func (c Config) TaskbarDock() string

TaskbarDock returns normalized dock side.

func (Config) UseImageWallpaper

func (c Config) UseImageWallpaper() bool

UseImageWallpaper reports whether to blit a half-block image wallpaper.

func (Config) UsePatternDesktop

func (c Config) UsePatternDesktop() bool

UsePatternDesktop reports whether to draw the theme pattern (not image/solid).

func (Config) UseSolidDesktop

func (c Config) UseSolidDesktop() bool

func (Config) UsedIcons

func (c Config) UsedIcons() map[string]struct{}

UsedIcons returns emoji/icon glyphs already claimed by programs, desktop icons, or builtins.

type DesktopIcon

type DesktopIcon struct {
	Label  string `json:"label"`
	Icon   string `json:"icon,omitempty"` // emoji or short text — not bound to action type
	X      int    `json:"x"`
	Y      int    `json:"y"`
	Action string `json:"action"` // terminal | notes | clock | settings | image | files | pty:<cmd> | app:<name>
}

DesktopIcon is a free-form desktop shortcut (icon glyph is optional / user-chosen).

func DefaultDesktopIcons

func DefaultDesktopIcons() []DesktopIcon

type FilesCfg

type FilesCfg struct {
	View          string `json:"view"` // list | grid
	ShowHidden    bool   `json:"show_hidden"`
	Sort          string `json:"sort"`      // name | size | mtime
	StartDir      string `json:"start_dir"` // home | last | path
	ConfirmDelete bool   `json:"confirm_delete"`
	LastDir       string `json:"last_dir,omitempty"`
}

FilesCfg controls the Files app.

func DefaultFiles

func DefaultFiles() FilesCfg

type NotifyCfg

type NotifyCfg struct {
	Banners      bool `json:"banners"`
	DismissSec   int  `json:"dismiss_sec"`
	SSHBadgeOnly bool `json:"ssh_badge_only"`
	Persist      bool `json:"persist"`  // write history to notifications.json
	MaxHist      int  `json:"max_hist"` // cap persisted/in-memory list
}

NotifyCfg controls system notification UI.

type PaletteCfg

type PaletteCfg struct {
	MaxResults        int  `json:"max_results"`
	StartOpensPalette bool `json:"start_opens_palette"` // Start button / Start hotkey opens palette
	ASCIIIcons        bool `json:"ascii_icons"`         // draw ASCII substitutes for emoji icons
}

PaletteCfg tunes the command palette.

type Program

type Program struct {
	ID      string `json:"id"`
	Name    string `json:"name"`    // display name in TTYPE Desk (e.g. "Task Manager")
	Command string `json:"command"` // run via $SHELL -c (e.g. "htop"), or the X11/extapp command if Bridge/ExtApp
	Icon    string `json:"icon"`
	Menu    string `json:"menu"`              // programs | system
	Desktop bool   `json:"desktop"`           // keep a desktop shortcut in sync
	Bridge  bool   `json:"bridge,omitempty"`  // launch Command via the GUI-TUI Bridge, not a shell PTY
	ExtApp  bool   `json:"ext_app,omitempty"` // launch Command as an out-of-process App SDK binary, not a shell PTY
}

Program is a user-registered app: usually a shell command run in a PTY window, or — if Bridge is set — an X11 GUI app launched through the GUI-TUI Bridge (see internal/bridge) instead, or — if ExtApp is set — an out-of-process App SDK binary (see internal/surface.ExtAppSurface, docs/extapp.md) instead. At most one of Bridge/ExtApp should be set.

func (Program) MenuFolder

func (p Program) MenuFolder() string

MenuFolder returns programs or system (default programs).

type Recipe

type Recipe struct {
	Match   string `json:"match"`
	Action  string `json:"action"`
	Confirm bool   `json:"confirm,omitempty"`
}

Recipe is a command-palette phrase → LaunchAction.

type Roles

type Roles struct {
	Terminal string `json:"terminal,omitempty"`
	Editor   string `json:"editor,omitempty"`
	Browser  string `json:"browser,omitempty"`
	FileMgr  string `json:"filemgr,omitempty"`
	Image    string `json:"image,omitempty"`
}

Roles map logical app slots to launch actions.

type TaskbarCfg

type TaskbarCfg struct {
	Dock string `json:"dock"` // top | bottom | left | right
}

TaskbarCfg controls taskbar docking.

type Theme

type Theme struct {
	Name            string     `json:"name,omitempty"` // e.g. "XP", "Scarlet"
	DesktopBG       cell.Color `json:"desktop_bg"`
	DesktopPattern  string     `json:"desktop_pattern"` // one char / emoji; empty = solid
	TaskbarBG       cell.Color `json:"taskbar_bg"`
	TaskbarFG       cell.Color `json:"taskbar_fg"`
	StartBG         cell.Color `json:"start_bg"`
	StartFG         cell.Color `json:"start_fg"`
	MenuBG          cell.Color `json:"menu_bg"`
	MenuFG          cell.Color `json:"menu_fg"`
	MenuHighlight   cell.Color `json:"menu_highlight"`
	TitleFocused    cell.Color `json:"title_focused"`
	TitleUnfocused  cell.Color `json:"title_unfocused"`
	TitleFG         cell.Color `json:"title_fg"`
	BorderFocused   cell.Color `json:"border_focused"`
	BorderUnfocused cell.Color `json:"border_unfocused"`
	WindowBody      cell.Color `json:"window_body"`
	Shadow          cell.Color `json:"shadow"`
	ShadowDX        int        `json:"shadow_dx"`
	ShadowDY        int        `json:"shadow_dy"`
	DefaultFG       cell.Color `json:"default_fg"`
	DefaultBG       cell.Color `json:"default_bg"`
	IconFG          cell.Color `json:"icon_fg"`
	IconLabelFG     cell.Color `json:"icon_label_fg"`
}

Theme holds chrome colors. Shipped packs live in themes.go (XP, Scarlet, Bumble, Bubble, Sprout).

func BubbleTheme

func BubbleTheme() Theme

BubbleTheme — stacked blues (BlueBubble wallpaper).

func BumbleTheme

func BumbleTheme() Theme

BumbleTheme — yellow / black / white hive (honeycomb wallpaper).

func DefaultTheme

func DefaultTheme() Theme

DefaultTheme returns the XP theme (Windows XP–inspired chrome).

func ScarletTheme

func ScarletTheme() Theme

ScarletTheme — red & black heat (Red wallpaper).

func SproutTheme

func SproutTheme() Theme

SproutTheme — green face with blue & yellow accents.

func XPTheme

func XPTheme() Theme

XPTheme is the classic TTYPE Desk look: XP blues/greens + Bliss wallpaper by default.

func (Theme) PatternRune

func (t Theme) PatternRune() rune

type ThemePack

type ThemePack struct {
	ID        string // xp, scarlet, bumble, bubble, sprout
	Name      string // display name
	Tagline   string // short fun blurb
	Wallpaper string // builtin:…
	Theme     Theme
}

ThemePack pairs chrome colors with a wallpaper.

func LookupThemePack

func LookupThemePack(idOrName string) (ThemePack, bool)

LookupThemePack matches by ID or display name (case-insensitive).

func NextThemePack

func NextThemePack(currentName string) ThemePack

NextThemePack returns the pack after the current theme name (wraps).

func ThemePacks

func ThemePacks() []ThemePack

ThemePacks returns the shipped theme packs (XP + wallpaper-matched palettes).

type Wallpaper

type Wallpaper struct {
	Mode    string `json:"mode"`     // solid | pattern | image
	Path    string `json:"path"`     // image path when mode=image
	Fit     string `json:"fit"`      // cover | contain | stretch
	SSHMode string `json:"ssh_mode"` // solid | keep — override when over SSH
}

Wallpaper configures the desktop background.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL