1package domain
2
3import "time"
4
5// MinBarInterval is the minimum supported bar refresh interval.
6const MinBarInterval = time.Second
7
8// DefaultWordSeparators matches tmux's practical shell-oriented word boundaries.
9const DefaultWordSeparators = " -_@"
10
11// ThemeMode selects how vev derives its color scheme.
12type ThemeMode int
13
14const (
15 // ThemeAuto follows the attached client's reported color scheme.
16 ThemeAuto ThemeMode = iota
17 // ThemeDark forces vev's built-in dark palette.
18 ThemeDark
19 // ThemeLight forces vev's built-in light palette.
20 ThemeLight
21)
22
23// ConfigEntry preserves one parsed config key/value in file order.
24type ConfigEntry struct {
25 Key string
26 Value string
27}
28
29// SnapshotConfig contains user-configurable snapshot restore settings.
30type SnapshotConfig struct {
31 RestoreProcesses []string
32 RestoreProcessesSet bool
33}
34
35// defaultSnapshotRestoreProcesses is the default allowlist for process restore.
36var defaultSnapshotRestoreProcesses = []string{
37 "vi", "vim", "nvim", "emacs", "man", "less", "more", "tail", "top", "htop", "btop",
38 "claude", "codex", "pi", "opencode",
39}
40
41// DefaultSnapshotRestoreProcesses returns a copy of the default process restore allowlist.
42func DefaultSnapshotRestoreProcesses() []string {
43 return append([]string(nil), defaultSnapshotRestoreProcesses...)
44}
45
46// BarConfig contains user-configurable bar right-anchor settings.
47type BarConfig struct {
48 TopRight string
49 BottomRight string
50 Interval time.Duration
51}
52
53// CopyConfig contains copy-mode text selection settings.
54type CopyConfig struct {
55 WordSeparators string
56}
57
58// PaletteConfig contains palette placement settings. A false AnchorSet uses the
59// adaptive automatic placement.
60type PaletteConfig struct {
61 Anchor Anchor
62 AnchorSet bool
63}
64
65// FloatingConfig contains launch and sizing settings for per-tab floating panes.
66type FloatingConfig struct {
67 Command string
68 Width int
69 Height int
70}
71
72// NavConfig contains directional navigation overflow settings.
73type NavConfig struct {
74 OverflowTabs bool
75 OverflowSessions bool
76}
77
78// TabsConfig contains tab label display settings.
79type TabsConfig struct {
80 // TerminalTitle includes the focused pane's OSC terminal title in tab
81 // labels (top bar and session picker). The process name always shows.
82 TerminalTitle bool
83}
84
85// Config is the user-editable vev configuration after parsing. Unknown binding
86// keys are preserved here (in BindingEntries, in file order) so the usecase
87// layer can decide which actions it understands.
88type Config struct {
89 Theme ThemeMode
90 ThemePalette bool
91 ThemeAccent ThemeAccent
92 Bar BarConfig
93 BindingEntries []ConfigEntry
94 Codes map[string]string
95 Snapshot SnapshotConfig
96 Copy CopyConfig
97 Palette PaletteConfig
98 Floating FloatingConfig
99 Nav NavConfig
100 Tabs TabsConfig
101}
102
103// Warning describes a non-fatal config problem. Parsers and reloaders should
104// warn and continue with defaults rather than aborting startup.
105type Warning struct {
106 Line int
107 Msg string
108}
109
110// Defaults returns vev's default configuration.
111func Defaults() Config {
112 return Config{
113 Theme: ThemeAuto,
114 ThemePalette: true,
115 ThemeAccent: ThemeAccent{Mode: ThemeAccentAuto},
116 Bar: BarConfig{
117 Interval: 5 * time.Second,
118 },
119 BindingEntries: []ConfigEntry{},
120 Codes: map[string]string{},
121 Snapshot: SnapshotConfig{
122 RestoreProcesses: DefaultSnapshotRestoreProcesses(),
123 },
124 Copy: CopyConfig{
125 WordSeparators: DefaultWordSeparators,
126 },
127 Palette: PaletteConfig{
128 Anchor: AnchorCenter,
129 AnchorSet: true,
130 },
131 Floating: FloatingConfig{
132 Width: 80,
133 Height: 80,
134 },
135 Tabs: TabsConfig{
136 TerminalTitle: true,
137 },
138 }
139}