Support Ghostty 1.4, version 1.0.2
The built-in schema now describes Ghostty 1.4.0: 212 options, the new choices of copy-on-select, window-padding-balance = equal, number limits that also take "unlimited", and categories for the new options. genschema reads Ghostty's compatibility table, so old names and values Ghostty still accepts are no longer reported as errors: a renamed key such as scrollback-limit is shown in yellow and renamed in place with enter, a replaced option names its successors, and old values such as copy-on-select = true are accepted with a note. Theme previews expand ~/ like Ghostty 1.4 and only look where Ghostty looks for user themes. Theme names with parentheses of their own keep them. A live test checks every ghostty command against the installed Ghostty. Docs and screenshots updated for 1.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fb5602452a
commit
df261910c5
26 files changed
+920
-132
No files matched your search
@@ -68,21 +68,23 @@ type Theme struct {
|
||||
}
|
||||
|
||||
// ThemeDirs returns the directories searched for themes, user dirs first.
|
||||
// Like Ghostty, this is the XDG config directory even on macOS, where the
|
||||
// config file itself usually lives under Application Support.
|
||||
func (g *Ghostty) ThemeDirs() []string {
|
||||
dirs := []string{filepath.Join(xdgConfigDir(), "themes")}
|
||||
if runtime.GOOS == "darwin" {
|
||||
dirs = append(dirs, filepath.Join(macConfigDir(), "themes"))
|
||||
}
|
||||
if r := g.ResourcesDir(); r != "" {
|
||||
dirs = append(dirs, filepath.Join(r, "themes"))
|
||||
}
|
||||
return dirs
|
||||
}
|
||||
|
||||
// LoadTheme reads a theme by name (or absolute path) for previewing.
|
||||
// LoadTheme reads a theme by name (or path) for previewing. A leading "~/"
|
||||
// stands for the home directory, as in Ghostty 1.4 and later.
|
||||
func (g *Ghostty) LoadTheme(name string) (*Theme, error) {
|
||||
var path string
|
||||
if filepath.IsAbs(name) {
|
||||
if rest, ok := strings.CutPrefix(name, "~/"); ok {
|
||||
path = filepath.Join(os.Getenv("HOME"), rest)
|
||||
} else if filepath.IsAbs(name) {
|
||||
path = name
|
||||
} else {
|
||||
for _, d := range g.ThemeDirs() {
|
||||
|
||||
Reference in new issue
Block a user