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:
mikeandClaude Opus 5.5 committed 2026-10-28 10:44:23 +01:00
1 parent fb5602452a
commit df261910c5
26 files changed
+920 -132

No files matched your search

+14
View File
@@ -340,6 +340,20 @@ func (f *File) Unset(key string) {
f.Lines = kept
}
// Rename gives every entry of key old the key new, in place. Only the key
// is replaced, so indentation and the formatting of the value stay as they
// were.
func (f *File) Rename(old, new string) {
for i, l := range f.Lines {
if l.Key != old {
continue
}
at := strings.Index(l.Raw, old) // the key is the first word of the line
f.Lines[i].Raw = l.Raw[:at] + new + l.Raw[at+len(old):]
f.Lines[i].Key = new
}
}
// Bytes renders the file.
func (f *File) Bytes() []byte {
var b bytes.Buffer
+12
View File
@@ -125,6 +125,18 @@ func TestUnset(t *testing.T) {
}
}
func TestRenameKeepsLayout(t *testing.T) {
f := parse(t, "# limits\n scrollback-limit=100000\nfont-size = 15\nscrollback-limit = \"2000\"\n")
f.Rename("scrollback-limit", "scrollback-limit-bytes")
want := "# limits\n scrollback-limit-bytes=100000\nfont-size = 15\nscrollback-limit-bytes = \"2000\"\n"
if got := string(f.Bytes()); got != want {
t.Fatalf("got\n%s\nwant\n%s", got, want)
}
if f.Has("scrollback-limit") || len(f.GetAll("scrollback-limit-bytes")) != 2 {
t.Fatal("keys not renamed")
}
}
func TestFormatLineQuoting(t *testing.T) {
cases := map[string]string{
"bar": "k = bar",
+5 -3
View File
@@ -110,9 +110,11 @@ func (g *Ghostty) Themes() ([]string, error) {
if line == "" {
continue
}
// Lines look like "Dracula (resources)" or "Mine (user)".
if i := strings.LastIndex(line, " ("); i > 0 && strings.HasSuffix(line, ")") {
line = line[:i]
// Lines look like "Dracula (resources)" or "Mine (user)". Only these
// two are cut off: names such as "Black Metal (Bathory)" have
// parentheses of their own.
for _, loc := range []string{" (resources)", " (user)"} {
line = strings.TrimSuffix(line, loc)
}
if !seen[line] {
seen[line] = true
+88
View File
@@ -0,0 +1,88 @@
package ghostty
import (
"os"
"path/filepath"
"slices"
"strings"
"testing"
)
// TestLiveGhostty runs every command ghosttyconf uses against the installed
// Ghostty and checks that the output is still understood. It is meant for a
// new Ghostty release and only runs when asked for:
//
// GHOSTTYCONF_LIVE_TEST=1 go test -run Live -v ./internal/ghostty
func TestLiveGhostty(t *testing.T) {
if os.Getenv("GHOSTTYCONF_LIVE_TEST") == "" {
t.Skip("set GHOSTTYCONF_LIVE_TEST=1 to run against the installed Ghostty")
}
g, err := Find(os.Getenv("GHOSTTYCONF_GHOSTTY"))
if err != nil {
t.Fatal(err)
}
if g.Version == "" {
t.Fatal("+version: no version found")
}
t.Logf("Ghostty %s at %s", g.Version, g.Bin)
docs, err := g.DefaultsWithDocs()
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"\nfont-family = ", "\nkeybind = ", "\n# "} {
if !strings.Contains(docs, want) {
t.Errorf("+show-config --default --docs: no %q", want)
}
}
themes, err := g.Themes()
if err != nil {
t.Fatal(err)
}
if len(themes) < 100 || !slices.Contains(themes, "Catppuccin Mocha") {
t.Errorf("+list-themes: %d themes, Catppuccin Mocha missing or too few", len(themes))
}
for _, name := range themes {
if strings.HasSuffix(name, " (resources)") || strings.HasSuffix(name, " (user)") {
t.Errorf("+list-themes: location left on %q", name)
break
}
}
th, err := g.LoadTheme("Catppuccin Mocha")
if err != nil {
t.Fatalf("theme file: %v", err)
}
if th.Background == "" || th.Palette[15] == "" {
t.Errorf("theme file: %+v", th)
}
fonts, err := g.Fonts()
if err != nil || len(fonts) == 0 {
t.Errorf("+list-fonts: %d fonts, %v", len(fonts), err)
}
actions, err := g.Actions()
if err != nil {
t.Fatal(err)
}
byName := map[string]Action{}
for _, a := range actions {
byName[a.Name] = a
}
if a := byName["new_split"]; len(actions) < 50 || a.Summary == "" || !strings.Contains(a.Doc, "right") {
t.Errorf("+list-actions --docs: %d actions, new_split = %+v", len(actions), a)
}
conf := filepath.Join(t.TempDir(), "config")
if err := os.WriteFile(conf, []byte("font-size = 14\nfont-size = abc\nbogus-key = 1\n"), 0o644); err != nil {
t.Fatal(err)
}
errs, err := g.Validate(conf)
if err != nil {
t.Fatal(err)
}
if len(errs) != 2 || errs[0].Line != 2 || errs[1].Line != 3 {
t.Errorf("+validate-config: %v", errs)
}
}
+7 -5
View File
@@ -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() {
+42
View File
@@ -0,0 +1,42 @@
package ghostty
import (
"os"
"path/filepath"
"slices"
"testing"
)
func TestLoadThemeExpandsHome(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
dir := filepath.Join(home, "themes")
if err := os.MkdirAll(dir, 0o755); err != nil {
t.Fatal(err)
}
theme := "background = #252528\npalette = 1=#f38ba8\n"
if err := os.WriteFile(filepath.Join(dir, "mine"), []byte(theme), 0o644); err != nil {
t.Fatal(err)
}
th, err := (&Ghostty{}).LoadTheme("~/themes/mine")
if err != nil {
t.Fatal(err)
}
if th.Background != "#252528" || th.Palette[1] != "#f38ba8" {
t.Errorf("theme: %+v", th)
}
}
// Ghostty looks for user themes in the XDG config directory only, also on
// macOS, where the config file usually lives under Application Support.
func TestThemeDirsFollowGhostty(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
t.Setenv("XDG_CONFIG_HOME", "")
t.Setenv("GHOSTTY_RESOURCES_DIR", "")
got := (&Ghostty{}).ThemeDirs()
want := []string{filepath.Join(home, ".config", "ghostty", "themes")}
if !slices.Equal(got, want) {
t.Errorf("ThemeDirs = %v, want %v", got, want)
}
}
+4 -1
View File
@@ -61,16 +61,17 @@ var categoryByKey = map[string]string{
"grapheme-width-method": CatFonts,
"window-new-tab-position": CatTabsSplits,
"window-show-tab-bar": CatTabsSplits,
"drag-handle": CatTabsSplits,
"window-inherit-working-directory": CatShell,
"tab-inherit-working-directory": CatShell,
"split-inherit-working-directory": CatShell,
"scrollback-limit": CatScrolling,
"scrollbar": CatScrolling,
"scroll-to-bottom": CatScrolling,
"mouse-scroll-multiplier": CatScrolling,
"focus-follows-mouse": CatMouse,
"click-repeat-interval": CatMouse,
"right-click-action": CatMouse,
"middle-click-action": CatMouse,
"copy-on-select": CatClipboard,
"command": CatShell,
"initial-command": CatShell,
@@ -96,12 +97,14 @@ var categoryByKey = map[string]string{
"initial-window": CatWindow,
"confirm-close-surface": CatWindow,
"undo-timeout": CatWindow,
"vt-window-resize-allowed": CatWindow,
}
var categoryPrefixes = []struct {
prefix, cat string
}{
{"quick-terminal-", CatQuickTerminal},
{"scrollback-", CatScrolling},
{"gtk-quick-terminal-", CatQuickTerminal},
{"custom-shader", CatShaders},
{"adjust-cursor-", CatCursor},
+52 -1
View File
@@ -59,6 +59,24 @@ type Option struct {
Category string `json:"-"`
Platform string `json:"-"` // "", "macOS" or "Linux"
// OldValues are values Ghostty no longer documents but still accepts
// (from Schema.Compat).
OldValues []string `json:"-"`
}
// Compat is an entry of Ghostty's compatibility table: a key or value from
// an older release that Ghostty still reads although it is no longer
// documented.
type Compat struct {
Key string `json:"key"`
RenamedTo string `json:"renamedTo,omitempty"` // the key's current name
Values []string `json:"values,omitempty"` // old values of a current option
Sets []string `json:"sets,omitempty"` // options an old key sets instead
}
// IsOldValue reports whether v is an old value Ghostty still accepts.
func (o *Option) IsOldValue(v string) bool {
return contains(o.OldValues, strings.TrimSpace(Unquote(v)))
}
// Default returns the default value for scalar options ("" when unset).
@@ -100,6 +118,9 @@ func (o *Option) TypeLabel() string {
} else if o.Min != nil {
s += fmt.Sprintf(" (%s or more)", num(*o.Min))
}
if len(o.Values) > 0 {
s += " or " + strings.Join(o.Values, ", ")
}
case KindFloat:
s = "number"
if o.Min != nil && o.Max != nil {
@@ -143,10 +164,12 @@ func (o *Option) TypeLabel() string {
type Schema struct {
GhosttyVersion string `json:"ghosttyVersion"`
Options []*Option `json:"options"`
Compat []*Compat `json:"compat,omitempty"`
// Source describes where docs and defaults came from.
Source string `json:"-"`
byKey map[string]*Option
byKey map[string]*Option
compatBy map[string]*Compat
}
//go:embed schema.json
@@ -168,13 +191,41 @@ func (s *Schema) Lookup(key string) *Option {
return s.byKey[key]
}
// OldKey returns the compatibility entry for a key that is no longer an
// option of its own (renamed or replaced), or nil.
func (s *Schema) OldKey(key string) *Compat {
if c := s.compatBy[key]; c != nil && s.byKey[key] == nil {
return c
}
return nil
}
// OldNames returns the old keys that Ghostty reads as key.
func (s *Schema) OldNames(key string) []string {
var out []string
for _, c := range s.Compat {
if c.RenamedTo == key && s.byKey[c.Key] == nil {
out = append(out, c.Key)
}
}
return out
}
func (s *Schema) finish() {
s.byKey = make(map[string]*Option, len(s.Options))
for _, o := range s.Options {
o.Category = categorize(o.Key)
o.Platform = platform(o)
o.OldValues = nil
s.byKey[o.Key] = o
}
s.compatBy = make(map[string]*Compat, len(s.Compat))
for _, c := range s.Compat {
s.compatBy[c.Key] = c
if o := s.byKey[c.Key]; o != nil {
o.OldValues = c.Values
}
}
}
// Refresh replaces docs and defaults with the output of
+228 -30
View File
@@ -1,5 +1,5 @@
{
"ghosttyVersion": "1.3.1",
"ghosttyVersion": "1.4.0",
"options": [
{
"key": "language",
@@ -538,7 +538,7 @@
"key": "selection-word-chars",
"zigType": "SelectionWordChars",
"kind": "text",
"doc": "Characters that mark word boundaries during text selection operations such\nas double-clicking. When selecting a word, the selection will stop at any\nof these characters.\n\nThis is similar to the `WORDCHARS` environment variable in zsh, except this\nspecifies the boundary characters rather than the word characters. The\ndefault includes common delimiters and punctuation that typically separate\nwords in code and prose.\n\nEach character in this string becomes a word boundary. Multi-byte UTF-8\ncharacters are supported, but only single codepoints can be specified.\nMulti-codepoint sequences (e.g. emoji) are not supported.\n\nThe null character (U+0000) is always treated as a boundary and does not\nneed to be included in this configuration.\n\nDefault: `` \\t'\"│`|:;,()[]{}\u003c\u003e$ ``\n\nTo add or remove specific characters, you can set this to a custom value.\nFor example, to treat semicolons as part of words:\n\n selection-word-chars = \" \\t'\\\"│`|:,()[]{}\u003c\u003e$\"\n\nAvailable since: 1.3.0",
"doc": "Characters that mark word boundaries during text selection operations such\nas double-clicking. When selecting a word, the selection will stop at any\nof these characters.\n\nThis is similar to the `WORDCHARS` environment variable in zsh, except this\nspecifies the boundary characters rather than the word characters. The\ndefault includes common delimiters and punctuation that typically separate\nwords in code and prose.\n\nEach character in this string becomes a word boundary. Multi-byte UTF-8\ncharacters are supported, but only single codepoints can be specified.\nMulti-codepoint sequences (e.g. emoji) are not supported.\n\nThe null character (U+0000) is always treated as a boundary and does not\nneed to be included in this configuration.\n\nDefault: ``\\t '\"│`|:;,()[]{}\u003c\u003e$``\n\nTo add or remove specific characters, you can set this to a custom value.\nFor example, to treat semicolons as part of words:\n\n selection-word-chars = \"\\t '\\\"│`|:,()[]{}\u003c\u003e$\"\n\nAvailable since: 1.3.0",
"defaults": [
" \t'\"│`|:;,()[]{}\u003c\u003e$"
]
@@ -902,7 +902,7 @@
"key": "cursor-click-to-move",
"zigType": "bool",
"kind": "bool",
"doc": "Enables the ability to move the cursor at prompts by clicking on a\nlocation in the prompt text.\n\nThis feature requires shell integration, specifically prompt marking\nvia `OSC 133`. Some shells like Fish (v4) and Nu (0.111+) natively\nsupport this while others may require additional configuration or\nGhostty's shell integration features to be enabled.\n\nDepending on the shell, this works either by translating your click\nposition into a series of synthetic arrow key movements or by sending\na click event directly to the shell. In either case, some unexpected\nbehavior around edge cases is possible.",
"doc": "Enables the ability to move the cursor at prompts by clicking on a\nlocation in the prompt text.\n\nThis feature requires prompt marking via `OSC 133`. Some shells like Fish\n(v4.1+) and Nu (0.111+) natively support this while others may require\nadditional configuration or Ghostty's shell integration features to be\nenabled.\n\nDepending on the shell, this works either by translating your click\nposition into a series of synthetic arrow key movements or by sending\na click event directly to the shell. In either case, some unexpected\nbehavior around edge cases is possible.",
"defaults": [
"true"
]
@@ -994,7 +994,7 @@
"macos-glass-clear"
],
"hint": "true, false, a blur radius (e.g. 20) or a macOS glass style",
"doc": "Whether to blur the background when `background-opacity` is less than 1.\n\nValid values are:\n\n * a nonnegative integer specifying the *blur intensity*\n * `false`, equivalent to a blur intensity of 0\n * `true`, equivalent to the default blur intensity of 20, which is\n reasonable for a good looking blur. Higher blur intensities may\n cause strange rendering and performance issues.\n\nOn macOS 26.0 and later, there are additional special values that\ncan be set to use the native macOS glass effects:\n\n * `macos-glass-regular` - Standard glass effect with some opacity\n * `macos-glass-clear` - Highly transparent glass effect\n\nIf the macOS values are set, then this implies `background-blur = true`\non non-macOS platforms.\n\nSupported on macOS and on some Linux desktop environments, including:\n\n * KDE Plasma (Wayland and X11)\n\nWarning: the exact blur intensity is _ignored_ under KDE Plasma, and setting\nthis setting to either `true` or any positive blur intensity value would\nachieve the same effect. The reason is that KWin, the window compositor\npowering Plasma, only has one global blur setting and does not allow\napplications to specify individual blur settings.\n\nTo configure KWin's global blur setting, open System Settings and go to\n\"Apps \u0026 Windows\" \u003e \"Window Management\" \u003e \"Desktop Effects\" and select the\n\"Blur\" plugin. If disabled, enable it by ticking the checkbox to the left.\nThen click on the \"Configure\" button and there will be two sliders that\nallow you to set background blur and noise intensities for all apps,\nincluding Ghostty.\n\nAll other Linux desktop environments are as of now unsupported. Users may\nneed to set environment-specific settings and/or install third-party plugins\nin order to support background blur, as there isn't a unified interface for\ndoing so.",
"doc": "Whether to blur the background when `background-opacity` is less than 1.\n\nValid values are:\n\n * a nonnegative integer specifying the *blur intensity*\n * `false`, equivalent to a blur intensity of 0\n * `true`, equivalent to the default blur intensity of 20, which is\n reasonable for a good looking blur. Higher blur intensities may\n cause strange rendering and performance issues.\n\nOn macOS 26.0 and later, there are additional special values that\ncan be set to use the native macOS glass effects:\n\n * `macos-glass-regular` - Standard glass effect with some opacity\n * `macos-glass-clear` - Highly transparent glass effect\n\nIf the macOS values are set, then this implies `background-blur = true`\non non-macOS platforms.\n\nOn Linux, the exact blur intensity is ignored and any positive integer\nor `true` value will enable background blur. On Wayland, Ghostty uses\nthe [`ext-background-effect-v1`](https://wayland.app/protocols/ext-background-effect-v1)\nprotocol to enable the blur effect, but this is not always supported\non all compositors. Check the documentation of your compositor or\ndesktop environment for blur support and how to configure it.\n\nOn X11, blur can only be enabled when using the KWin compositor\nas a part of KDE Plasma.",
"defaults": [
"false"
]
@@ -1191,13 +1191,38 @@
]
},
{
"key": "scrollback-limit",
"zigType": "usize",
"key": "scrollback-limit-bytes",
"zigType": "Limit(usize, 50_000_000)",
"kind": "int",
"values": [
"unlimited"
],
"min": 0,
"doc": "The size of the scrollback buffer in bytes. This also includes the active\nscreen. No matter what this is set to, enough memory will always be\nallocated for the visible screen and anything leftover is the limit for\nthe scrollback.\n\nWhen this limit is reached, the oldest lines are removed from the\nscrollback.\n\nScrollback currently exists completely in memory. This means that the\nlarger this value, the larger potential memory usage. Scrollback is\nallocated lazily up to this limit, so if you set this to a very large\nvalue, it will not immediately consume a lot of memory.\n\nThis size is per terminal surface, not for the entire application.\n\nIt is not currently possible to set an unlimited scrollback buffer.\nThis is a future planned feature.\n\nThis can be changed at runtime but will only affect new terminal surfaces.",
"doc": "The size of the scrollback buffer in bytes. This also includes the active\nscreen. No matter what this is set to, enough memory will always be\nallocated for the visible screen and anything leftover is the limit for\nthe scrollback.\n\nWhen this limit is reached, the oldest lines are removed from the\nscrollback.\n\nScrollback is stored in memory and allocated lazily up to this limit, so\nsetting a very large limit does not immediately consume that amount of\nmemory. On supported systems with scrollback compression enabled, Ghostty\nattempts to compress fully historical pages which are not currently visible\nwhile the terminal is idle. This can reduce physical memory usage, depending\non the contents of the scrollback.\n\nThis limit always measures the uncompressed logical size of the terminal\npages. Compression does not allow Ghostty to retain more history than the\nconfigured limit. Accessing compressed history restores it transparently\nand may increase the terminal's physical memory usage again.\n\nThis size is per terminal surface, not for the entire application.\n\nA separate maximum can be set with `scrollback-limit-lines`; if both limits\nare set, then the first one reached will determine when scrollback is\nremoved.\n\nThe default is 50 MB. Set this to `unlimited` to remove the byte limit.\n\nThis can be changed at runtime but will only affect new terminal surfaces.",
"defaults": [
"10000000"
"50000000"
]
},
{
"key": "scrollback-limit-lines",
"zigType": "Limit(usize, std.math.maxInt(usize))",
"kind": "int",
"values": [
"unlimited"
],
"min": 0,
"doc": "The maximum number of lines of scrollback to retain. This excludes\nthe active screen. Soft-wrapped lines count as multiple lines.\n\nThis limit is an estimate. Internally, Ghostty will only trim lines\nup to the minimum allocation unit that is used internally (called a\n\"page\"). The size of a page depends on how many styles, graphemes, etc.\ntake up the screen. In practice, this can be anywhere from a handful to\na couple hundred lines. Importantly, memory is capped either way.\nThis means that the actual limited lines will likely be slightly\nhigher in practice.\n\nThe default is `unlimited`. A separate maximum can be set with\n`scrollback-limit-bytes`; if both limits are set, then the first one reached\nwill determine when scrollback is removed.\n\nThis can be changed at runtime but will only affect new terminal surfaces.",
"defaults": [
"unlimited"
]
},
{
"key": "scrollback-compression",
"zigType": "bool",
"kind": "bool",
"doc": "Whether to compress scrollback pages while the terminal is idle.\n\nGhostty does its best to only compress when idle and decompress\nas needed. This means that compression doesn't lower IO throughput.\nWe recommend you keep it on.\n\nThe scrollback limit remains an uncompressed logical limit regardless of\nthis setting, so disabling compression can increase physical memory usage\nbut does not change how much history is retained.\n\nText-heavy terminal history generally compresses to approximately 10% to\n30% of its uncompressed page memory, corresponding to a 70% to 90% reduction\nin physical memory for pages which are compressed. Compression savings are\ncontent-dependent.\n\nNote that the way Ghostty works is that we compress and discard the\nphysical/resident memory but we retain virtual mappings. You will not\nsee a decrease in virtual memory usage, but you will see a decrease\nin physical/memory usage.\n\nChanging this at runtime affects future compression work. Pages which are\nalready compressed remain compressed until their contents are accessed.",
"defaults": [
"true"
]
},
{
@@ -1208,7 +1233,7 @@
"system",
"never"
],
"doc": "Control when the scrollbar is shown to scroll the scrollback buffer.\n\nThe default value is `system`.\n\nValid values:\n\n * `system` - Respect the system settings for when to show scrollbars.\n For example, on macOS, this will respect the \"Scrollbar behavior\"\n system setting which by default usually only shows scrollbars while\n actively scrolling or hovering the gutter.\n\n * `never` - Never show a scrollbar. You can still scroll using the mouse,\n keybind actions, etc. but you will not have a visual UI widget showing\n a scrollbar.",
"doc": "Control when the scrollbar is shown to scroll the scrollback buffer.\n\nThe default value is `system`.\n\nValid values:\n\n * `system` - Respect the system settings for when to show scrollbars.\n On macOS, we only show scrollbars while actively scrolling or hovering\n the gutter. If the system setting is set to \"Always\", the scrollbar\n will be shown when the mouse is over the gutter area.\n\n * `never` - Never show a scrollbar. You can still scroll using the mouse,\n keybind actions, etc. but you will not have a visual UI widget showing\n a scrollbar.",
"defaults": [
"system"
]
@@ -1222,6 +1247,15 @@
"true"
]
},
{
"key": "link-osc8",
"zigType": "bool",
"kind": "bool",
"doc": "Enable hyperlinks created with the OSC 8 escape sequence. When disabled,\nOSC 8 hyperlinks are not highlighted, previewed, copied, or opened.\n\nThis does not affect URL matching controlled by `link-url`.\n\nAvailable since: 1.4.0",
"defaults": [
"true"
]
},
{
"key": "link-previews",
"zigType": "LinkPreviews",
@@ -1307,10 +1341,10 @@
"zigType": "Keybinds",
"kind": "keybind",
"repeatable": true,
"doc": "Key bindings. The format is `trigger=action`. Duplicate triggers will\noverwrite previously set values. The list of actions is available in\nthe documentation or using the `ghostty +list-actions` command.\n\nTrigger: `+`-separated list of keys and modifiers. Example: `ctrl+a`,\n`ctrl+shift+b`, `up`.\n\nIf the key is a single Unicode codepoint, the trigger will match\nany presses that produce that codepoint. These are impacted by\nkeyboard layouts. For example, `a` will match the `a` key on a\nQWERTY keyboard, but will match the `q` key on a AZERTY keyboard\n(assuming US physical layout).\n\nFor Unicode codepoints, matching is done by comparing the set of\nmodifiers with the unmodified codepoint. The unmodified codepoint is\nsometimes called an \"unshifted character\" in other software, but all\nmodifiers are considered, not only shift. For example, `ctrl+a` will match\n`a` but not `ctrl+shift+a` (which is `A` on a US keyboard).\n\nFurther, codepoint matching is case-insensitive and the unmodified\ncodepoint is always case folded for comparison. As a result,\n`ctrl+A` configured will match when `ctrl+a` is pressed. Note that\nthis means some key combinations are impossible depending on keyboard\nlayout. For example, `ctrl+_` is impossible on a US keyboard because\n`_` is `shift+-` and `ctrl+shift+-` is not equal to `ctrl+_` (because\nthe modifiers don't match!). More details on impossible key combinations\ncan be found at this excellent source written by Qt developers:\nhttps://doc.qt.io/qt-6/qkeysequence.html#keyboard-layout-issues\n\nPhysical key codes can be specified by using any of the key codes\nas specified by the [W3C specification](https://www.w3.org/TR/uievents-code/).\nFor example, `KeyA` will match the physical `a` key on a US standard\nkeyboard regardless of the keyboard layout. These are case-sensitive.\n\nFor aesthetic reasons, the w3c codes also support snake case. For\nexample, `key_a` is equivalent to `KeyA`. The only exceptions are\nfunction keys, e.g. `F1` is `f1` (no underscore). This is a consequence\nof our internal code using snake case but is purposely supported\nand tested so it is safe to use. It allows an all-lowercase binding\nwhich I find more aesthetically pleasing.\n\nFunction keys such as `insert`, `up`, `f5`, etc. are also specified\nusing the keys as specified by the previously linked W3C specification.\n\nPhysical keys always match with a higher priority than Unicode codepoints,\nso if you specify both `a` and `KeyA`, the physical key will always be used\nregardless of what order they are configured.\n\nThe special key `catch_all` can be used to match any key that is not\notherwise bound. This can be combined with modifiers, for example\n`ctrl+catch_all` will match any key pressed with `ctrl` that is not\notherwise bound. When looking up a binding, Ghostty first tries to match\n`catch_all` with modifiers. If no match is found and the event has\nmodifiers, it falls back to `catch_all` without modifiers.\n\nValid modifiers are `shift`, `ctrl` (alias: `control`), `alt` (alias: `opt`,\n`option`), and `super` (alias: `cmd`, `command`). You may use the modifier\nor the alias. When debugging keybinds, the non-aliased modifier will always\nbe used in output.\n\nNote: The fn or \"globe\" key on keyboards are not supported as a\nmodifier. This is a limitation of the operating systems and GUI toolkits\nthat Ghostty uses.\n\nSome additional notes for triggers:\n\n * modifiers cannot repeat, `ctrl+ctrl+a` is invalid.\n\n * modifiers and keys can be in any order, `shift+a+ctrl` is *weird*,\n but valid.\n\n * only a single key input is allowed, `ctrl+a+b` is invalid.\n\nYou may also specify multiple triggers separated by `\u003e` to require a\nsequence of triggers to activate the action. For example,\n`ctrl+a\u003en=new_window` will only trigger the `new_window` action if the\nuser presses `ctrl+a` followed separately by `n`. In other software, this\nis sometimes called a leader key, a key chord, a key table, etc. There\nis no hardcoded limit on the number of parts in a sequence.\n\nWarning: If you define a sequence as a CLI argument to `ghostty`,\nyou probably have to quote the keybind since `\u003e` is a special character\nin most shells. Example: ghostty --keybind='ctrl+a\u003en=new_window'\n\nA trigger sequence has some special handling:\n\n * Ghostty will wait an indefinite amount of time for the next key in\n the sequence. There is no way to specify a timeout. The only way to\n force the output of a prefix key is to assign another keybind to\n specifically output that key (e.g. `ctrl+a\u003ectrl+a=text:foo`) or\n press an unbound key which will send both keys to the program.\n\n * If an unbound key is pressed during a sequence and a `catch_all`\n binding exists that would `ignore` the input, the entire sequence\n is dropped and nothing happens. Otherwise, the entire sequence is\n encoded and sent to the running program as if no keybind exLine truncated
"doc": "Key bindings. The format is `trigger=action`. Duplicate triggers will\noverwrite previously set values. The list of actions is available in\nthe documentation or using the `ghostty +list-actions` command.\n\nTrigger: `+`-separated list of keys and modifiers. Example: `ctrl+a`,\n`ctrl+shift+b`, `up`.\n\nIf the key is a single Unicode codepoint, the trigger will match\nany presses that produce that codepoint. These are impacted by\nkeyboard layouts. For example, `a` will match the `a` key on a\nQWERTY keyboard, but will match the `q` key on a AZERTY keyboard\n(assuming US physical layout).\n\nFor Unicode codepoints, matching is done by comparing the set of\nmodifiers with the unmodified codepoint. The unmodified codepoint is\nsometimes called an \"unshifted character\" in other software, but all\nmodifiers are considered, not only shift. For example, `ctrl+a` will match\n`a` but not `ctrl+shift+a` (which is `A` on a US keyboard).\n\nFurther, codepoint matching is case-insensitive and the unmodified\ncodepoint is always case folded for comparison. As a result,\n`ctrl+A` configured will match when `ctrl+a` is pressed. Note that\nthis means some key combinations are impossible depending on keyboard\nlayout. For example, `ctrl+_` is impossible on a US keyboard because\n`_` is `shift+-` and `ctrl+shift+-` is not equal to `ctrl+_` (because\nthe modifiers don't match!). More details on impossible key combinations\ncan be found at this excellent source written by Qt developers:\nhttps://doc.qt.io/qt-6/qkeysequence.html#keyboard-layout-issues\n\nPhysical key codes can be specified by using any of the key codes\nas specified by the [W3C specification](https://www.w3.org/TR/uievents-code/).\nFor example, `KeyA` will match the physical `a` key on a US standard\nkeyboard regardless of the keyboard layout. These are case-sensitive.\n\nFor aesthetic reasons, the w3c codes also support snake case. For\nexample, `key_a` is equivalent to `KeyA`. The only exceptions are\nfunction keys, e.g. `F1` is `f1` (no underscore). This is a consequence\nof our internal code using snake case but is purposely supported\nand tested so it is safe to use. It allows an all-lowercase binding\nwhich I find more aesthetically pleasing.\n\nFunction keys such as `insert`, `up`, `f5`, etc. are also specified\nusing the keys as specified by the previously linked W3C specification.\n\nPhysical keys always match with a higher priority than Unicode codepoints,\nso if you specify both `a` and `KeyA`, the physical key will always be used\nregardless of what order they are configured.\n\nThe special key `catch_all` can be used to match any key that is not\notherwise bound. This can be combined with modifiers, for example\n`ctrl+catch_all` will match any key pressed with `ctrl` that is not\notherwise bound. When looking up a binding, Ghostty first tries to match\n`catch_all` with modifiers. If no match is found and the event has\nmodifiers, it falls back to `catch_all` without modifiers.\n\nValid modifiers are `shift`, `ctrl` (alias: `control`), `alt` (alias: `opt`,\n`option`), and `super` (alias: `cmd`, `command`). You may use the modifier\nor the alias. When debugging keybinds, the non-aliased modifier will always\nbe used in output.\n\nNote: The fn or \"globe\" key on keyboards are not supported as a\nmodifier. This is a limitation of the operating systems and GUI toolkits\nthat Ghostty uses.\n\nSome additional notes for triggers:\n\n * modifiers cannot repeat, `ctrl+ctrl+a` is invalid.\n\n * modifiers and keys can be in any order, `shift+a+ctrl` is *weird*,\n but valid.\n\n * only a single key input is allowed, `ctrl+a+b` is invalid.\n\nYou may also specify multiple triggers separated by `\u003e` to require a\nsequence of triggers to activate the action. For example,\n`ctrl+a\u003en=new_window` will only trigger the `new_window` action if the\nuser presses `ctrl+a` followed separately by `n`. In other software, this\nis sometimes called a leader key, a key chord, a key table, etc. There\nis no hardcoded limit on the number of parts in a sequence.\n\nWarning: If you define a sequence as a CLI argument to `ghostty`,\nyou probably have to quote the keybind since `\u003e` is a special character\nin most shells. Example: ghostty --keybind='ctrl+a\u003en=new_window'\n\nA trigger sequence has some special handling:\n\n * Ghostty will wait an indefinite amount of time for the next key in\n the sequence. There is no way to specify a timeout. The only way to\n force the output of a prefix key is to assign another keybind to\n specifically output that key (e.g. `ctrl+a\u003ectrl+a=text:foo`) or\n press an unbound key which will send both keys to the program.\n\n * If an unbound key is pressed during a sequence and a `catch_all`\n binding exists that would `ignore` the input, the entire sequence\n is dropped and nothing happens. Otherwise, the entire sequence is\n encoded and sent to the running program as if no keybind exLine truncated
"defaults": [
"super+shift+,=reload_config",
"super+,=open_config",
"super+,=open_config:os_open",
"copy=copy_to_clipboard:mixed",
"paste=paste_from_clipboard",
"super+c=copy_to_clipboard:mixed",
@@ -1397,9 +1431,9 @@
"super+alt+i=inspector:toggle",
"super+ctrl+f=toggle_fullscreen",
"super+shift+v=paste_from_selection",
"super+arrow_right=text:\\\\x05",
"super+arrow_left=text:\\\\x01",
"super+backspace=text:\\\\x15",
"super+arrow_right=text:\\x05",
"super+arrow_left=text:\\x01",
"super+backspace=text:\\x15",
"alt+arrow_left=esc:b",
"alt+arrow_right=esc:f"
]
@@ -1435,9 +1469,14 @@
},
{
"key": "window-padding-balance",
"zigType": "bool",
"kind": "bool",
"doc": "The viewport dimensions are usually not perfectly divisible by the cell\nsize. In this case, some extra padding on the end of a column and the bottom\nof the final row may exist. If this is `true`, then this extra padding\nis automatically balanced between all four edges to minimize imbalance on\none side. If this is `false`, the top left grid cell will always hug the\nedge with zero padding other than what may be specified with the other\n`window-padding` options.\n\nIf other `window-padding` fields are set and this is `true`, this will still\napply. The other padding is applied first and may affect how many grid cells\nactually exist, and this is applied last in order to balance the padding\ngiven a certain viewport size and grid cell size.",
"zigType": "WindowPaddingBalance",
"kind": "enum",
"values": [
"false",
"true",
"equal"
],
"doc": "The viewport dimensions are usually not perfectly divisible by the cell\nsize. In this case, some extra padding on the end of a column and the bottom\nof the final row may exist. If this is `true`, then this extra padding\nis automatically balanced between all four edges to minimize imbalance on\none side. If this is `false`, the top left grid cell will always hug the\nedge with zero padding other than what may be specified with the other\n`window-padding` options.\n\nIf other `window-padding` fields are set and this is `true`, this will still\napply. The other padding is applied first and may affect how many grid cells\nactually exist, and this is applied last in order to balance the padding\ngiven a certain viewport size and grid cell size.\n\nValid values are:\n\n* `false` - No balancing is applied.\n* `true` - Balance the padding, but cap the top padding to avoid\n excessive space above the first row. Any excess is shifted to the\n bottom.\n* `equal` - Balance the padding equally on all sides without any\n top-padding cap. (Available since: 1.4.0)",
"defaults": [
"false"
]
@@ -1679,6 +1718,20 @@
""
]
},
{
"key": "drag-handle",
"zigType": "DragHandle",
"kind": "enum",
"values": [
"always",
"auto",
"never"
],
"doc": "Controls when drag handles are shown over splits,\nallowing splits to be rearranged with mouse controls.\n\nValid values:\n\n - `always`\n\n Always display the drag handle, even when there's only one split.\n\n - `auto` *(default)*\n\n Automatically show and hide the drag handle.\n\n On Linux, the handle is only shown when there are two or\n more splits present.\n\n On macOS, the handle is only hidden when there's one split\n in **fullscreen** mode, otherwise it's shown when hovered.\n\n - `never`\n\n Never show the drag handle. Splits then cannot be rearranged with\n mouse controls.\n\nAvailable since: 1.4.0.",
"defaults": [
"auto"
]
},
{
"key": "resize-overlay",
"zigType": "ResizeOverlay",
@@ -1757,6 +1810,19 @@
"allow"
]
},
{
"key": "clipboard-write-limit-bytes",
"zigType": "Limit(usize, 64 * 1024 * 1024)",
"kind": "int",
"values": [
"unlimited"
],
"min": 0,
"doc": "The maximum size in bytes of a single clipboard write by a program\nrunning in the terminal via the Kitty clipboard protocol (OSC 5522).\nThis doesn't apply to OSC 52, which is limited by the maximum length\nof an escape sequence hardcoded into Ghostty for now.\n\nData beyond the limit fails the entire write with an `EFBIG` status,\ndiscards the transaction, and leaves the clipboard untouched. Later\nwrite-related packets are ignored until a new write begins.\n\nThe data is buffered in memory while the write is in progress, so\nthis limit bounds how much memory a program can make Ghostty\nallocate per write. A future improvement will attempt to spool large\nwrites to disk.\n\nThe default is 64 MiB, the minimum a conforming implementation must\naccept. Set this to `unlimited` to remove the limit, allowing writes\nbounded only by available memory. A value of `0` rejects every non-empty\nwrite. To reject clipboard writes entirely, use `clipboard-write = deny`\ninstead.\n\nThis can be changed at runtime and applies to writes that begin\nafter the change.\n\nAvailable since: 1.4.0",
"defaults": [
"67108864"
]
},
{
"key": "clipboard-trim-trailing-spaces",
"zigType": "bool",
@@ -1770,7 +1836,7 @@
"key": "clipboard-paste-protection",
"zigType": "bool",
"kind": "bool",
"doc": "Require confirmation before pasting text that appears unsafe. This helps\nprevent a \"copy/paste attack\" where a user may accidentally execute unsafe\ncommands by pasting text with newlines.",
"doc": "Require confirmation before pasting text that appears unsafe. This helps\nprevent a \"copy/paste attack\" where a user may accidentally execute unsafe\ncommands by pasting text with newlines or carriage returns.",
"defaults": [
"true"
]
@@ -1809,13 +1875,14 @@
"zigType": "CopyOnSelect",
"kind": "enum",
"values": [
"false",
"true",
"clipboard"
"none",
"primary",
"clipboard",
"both"
],
"doc": "Whether to automatically copy selected text to the clipboard. `true`\nwill prefer to copy to the selection clipboard, otherwise it will copy to\nthe system clipboard.\n\nThe value `clipboard` will always copy text to the selection clipboard\nas well as the system clipboard.\n\nMiddle-click paste will always use the selection clipboard. Middle-click\npaste is always enabled even if this is `false`.\n\nThe default value is true on Linux and macOS.",
"doc": "Whether to automatically copy selected text to the clipboard.\n\nValid values:\n\n* `none` - Do not copy selected text automatically.\n\n* `primary` - On Linux, copy to the selection clipboard only. This has no\n effect on macOS. (Available since: 1.4.0)\n\n* `clipboard` - Copy text to the system clipboard only.\n\n* `both` - Copy to both clipboards on Linux, and only the system clipboard\n on macOS. (Available since: 1.4.0)\n\nFor backward compatibility and convenience, a value of `true` is the same as\n`primary` on Linux and `clipboard` on macOS, and `false` is an alias for\n`none`.\n\nThe default value is `primary` on Linux and `none` otherwise.",
"defaults": [
"true"
"none"
]
},
{
@@ -1834,6 +1901,20 @@
"context-menu"
]
},
{
"key": "middle-click-action",
"zigType": "MiddleClickAction",
"kind": "enum",
"values": [
"primary-paste",
"clipboard-paste",
"ignore"
],
"doc": "The action to take when the user middle-clicks on the terminal surface.\n\nValid values:\n * `primary-paste` - Paste from the selection clipboard on Linux.\n Does nothing on macOS.\n * `clipboard-paste` - Paste from the system clipboard.\n * `ignore` - Do nothing, ignore the middle click.\n\nThe default value is `primary-paste`.",
"defaults": [
"primary-paste"
]
},
{
"key": "click-repeat-interval",
"zigType": "u32",
@@ -1964,7 +2045,7 @@
"mouse",
"macos-menu-bar"
],
"doc": "The screen where the quick terminal should show up.\n\nValid values are:\n\n * `main` - The screen that the operating system recommends as the main\n screen. On macOS, this is the screen that is currently receiving\n keyboard input. This screen is defined by the operating system and\n not chosen by Ghostty.\n\n * `mouse` - The screen that the mouse is currently hovered over.\n\n * `macos-menu-bar` - The screen that contains the macOS menu bar as\n set in the display settings on macOS. This is a bit confusing because\n every screen on macOS has a menu bar, but this is the screen that\n contains the primary menu bar.\n\nThe default value is `main` because this is the recommended screen\nby the operating system.\n\nOnly implemented on macOS.",
"doc": "The screen where the quick terminal should show up.\n\nValid values are:\n\n * `main` - The screen that the operating system recommends as the main\n screen. On macOS, this is the screen that is currently receiving\n keyboard input. This screen is defined by the operating system and\n not chosen by Ghostty.\n\n * `mouse` - The screen that the mouse is currently hovered over.\n\n * `macos-menu-bar` - The screen that contains the macOS menu bar as\n set in the display settings on macOS. This is a bit confusing because\n every screen on macOS has a menu bar, but this is the screen that\n contains the primary menu bar.\n\nThe default value is `main` because this is the recommended screen\nby the operating system.\n\nOn macOS, `macos-menu-bar` uses the screen containing the menu bar.\nOn Linux/Wayland, `macos-menu-bar` is treated as equivalent to `main`.\n\nNote: On Linux, there is no universal concept of a \"primary\" monitor.\nGhostty uses the compositor-reported primary output when available and\nfalls back to the first monitor reported by GDK if no primary output can\nbe resolved.",
"defaults": [
"main"
]
@@ -2044,7 +2125,7 @@
"ssh-terminfo",
"path"
],
"doc": "Shell integration features to enable. These require our shell integration\nto be loaded, either automatically via shell-integration or manually.\n\nThe format of this is a list of features to enable separated by commas. If\nyou prefix a feature with `no-` then it is disabled. If you omit a feature,\nits default value is used, so you must explicitly disable features you don't\nwant. You can also use `true` or `false` to turn all features on or off.\n\nExample: `cursor`, `no-cursor`, `sudo`, `no-sudo`, `title`, `no-title`\n\nAvailable features:\n\n * `cursor` - Set the cursor to a bar at the prompt.\n\n * `sudo` - Set sudo wrapper to preserve terminfo.\n\n * `title` - Set the window title via shell integration.\n\n * `ssh-env` - Enable SSH environment variable compatibility. Automatically\n converts TERM from `xterm-ghostty` to `xterm-256color` when connecting to\n remote hosts and propagates COLORTERM, TERM_PROGRAM, and TERM_PROGRAM_VERSION.\n Whether or not these variables will be accepted by the remote host(s) will\n depend on whether or not the variables are allowed in their sshd_config.\n (Available since: 1.2.0)\n\n * `ssh-terminfo` - Enable automatic terminfo installation on remote hosts.\n Attempts to install Ghostty's terminfo entry using `infocmp` and `tic` when\n connecting to hosts that lack it. Requires `infocmp` to be available locally\n and `tic` to be available on remote hosts. Once terminfo is installed on a\n remote host, it will be automatically \"cached\" to avoid repeat installations.\n If desired, the `+ssh-cache` CLI action can be used to manage the installation\n cache manually using various arguments.\n (Available since: 1.2.0)\n\n * `path` - Add Ghostty's binary directory to PATH. This ensures the `ghostty`\n command is available in the shell even if shell init scripts reset PATH.\n This is particularly useful on macOS where PATH is often overridden by\n system scripts. The directory is only added if not already present.\n\nSSH features work independently and can be combined for optimal experience:\nwhen both `ssh-env` and `ssh-terminfo` are enabled, Ghostty will install its\nterminfo on remote hosts and use `xterm-ghostty` as TERM, falling back to\n`xterm-256color` with environment variables if terminfo installation fails.",
"doc": "Shell integration features to enable. These require our shell integration\nto be loaded, either automatically via shell-integration or manually.\n\nThe format of this is a list of features to enable separated by commas. If\nyou prefix a feature with `no-` then it is disabled. If you omit a feature,\nits default value is used, so you must explicitly disable features you don't\nwant. You can also use `true` or `false` to turn all features on or off.\n\nExample: `cursor`, `no-cursor`, `sudo`, `no-sudo`, `title`, `no-title`\n\nAvailable features:\n\n * `cursor` - Set the cursor to a bar at the prompt.\n\n * `sudo` - Set sudo wrapper to preserve terminfo.\n\n * `title` - Set the window title via shell integration.\n\n * `ssh-env` - Enable SSH environment variable compatibility. Automatically\n converts TERM from `xterm-ghostty` to `xterm-256color` when connecting to\n remote hosts and propagates COLORTERM, TERM_PROGRAM, and TERM_PROGRAM_VERSION.\n Whether or not these variables will be accepted by the remote host(s) will\n depend on whether or not the variables are allowed in their sshd_config.\n (Available since: 1.2.0)\n\n * `ssh-terminfo` - Enable automatic terminfo installation on remote hosts.\n Attempts to install Ghostty's embedded terminfo entry using `tic` on local\n cache misses. Requires `tic` to be available on remote hosts. Successful\n installations are cached locally to avoid repeat installations.\n If desired, the `+ssh-cache` CLI action can be used to manage the installation\n cache manually using various arguments.\n (Available since: 1.2.0)\n\n * `path` - Add Ghostty's binary directory to PATH. This ensures the `ghostty`\n command is available in the shell even if shell init scripts reset PATH.\n This is particularly useful on macOS where PATH is often overridden by\n system scripts. The directory is only added if not already present.\n\nSSH features work independently and can be combined for optimal experience:\nwhen both `ssh-env` and `ssh-terminfo` are enabled, Ghostty will install its\nterminfo on remote hosts and use `xterm-ghostty` as TERM, falling back to\n`xterm-256color` with environment variables if terminfo installation fails.",
"defaults": [
"cursor,no-sudo,title,no-ssh-env,no-ssh-terminfo,path"
]
@@ -2055,10 +2136,11 @@
"kind": "text",
"repeatable": true,
"hint": "title:NAME,action:ACTION[,description:TEXT]",
"doc": "Custom entries into the command palette.\n\nEach entry requires the title, the corresponding action, and an optional\ndescription. Each field should be prefixed with the field name, a colon\n(`:`), and then the specified value. The syntax for actions is identical\nto the one for keybind actions. Whitespace in between fields is ignored.\n\nIf you need to embed commas or any other special characters in the values,\nenclose the value in double quotes and it will be interpreted as a Zig\nstring literal. This is also useful for including whitespace at the\nbeginning or the end of a value. See the\n[Zig documentation](https://ziglang.org/documentation/master/#Escape-Sequences)\nfor more information on string literals. Note that multiline string literals\nare not supported.\n\nDouble quotes can not be used around the field names.\n\n```ini\ncommand-palette-entry = title:Reset Font Style, action:csi:0m\ncommand-palette-entry = title:Crash on Main Thread,description:Causes a crash on the main (UI) thread.,action:crash:main\ncommand-palette-entry = title:Focus Split: Right,description:\"Focus the split to the right, if it exists.\",action:goto_split:right\ncommand-palette-entry = title:\"Ghostty\",description:\"Add a little Ghostty to your terminal.\",action:\"text:\\xf0\\x9f\\x91\\xbb\"\n```\n\nBy default, the command palette is preloaded with most actions that might\nbe useful in an interactive setting yet do not have easily accessible or\nmemorizable shortcuts. The default entries can be cleared by setting this\nsetting to an empty value:\n\n```ini\ncommand-palette-entry =\n```\n\nAvailable since: 1.2.0",
"doc": "Custom entries into the command palette.\n\nEach entry requires the title, the corresponding action, and an optional\ndescription. Each field should be prefixed with the field name, a colon\n(`:`), and then the specified value. The syntax for actions is identical\nto the one for keybind actions. Whitespace in between fields is ignored.\n\nIf you need to embed commas or any other special characters in the values,\nenclose the value in double quotes and it will be interpreted as a Zig\nstring literal. This is also useful for including whitespace at the\nbeginning or the end of a value. See the\n[Zig documentation](https://ziglang.org/documentation/master/#Escape-Sequences)\nfor more information on string literals. Note that multiline string literals\nare not supported.\n\nDouble quotes can not be used around the field names.\n\n```ini\ncommand-palette-entry = title:Reset Font Style, action:csi:0m\ncommand-palette-entry = title:Crash on Main Thread,description:Causes a crash on the main (UI) thread.,action:crash:main\ncommand-palette-entry = title:Focus Split: Right,description:\"Focus the split to the right, if it exists.\",action:goto_split:right\ncommand-palette-entry = title:\"Ghostty\",description:\"Add a little Ghostty to your terminal.\",action:\"text:\\xf0\\x9f\\x91\\xbb\"\n```\n\nThere are some additional special values that can be specified for\ncommand-palette-entry:\n\n * `command-palette-entry=clear` will clear all command entries. Warning: this\n removes ALL entries up to this point, including the default\n entries. Available since: 1.4.0\n\nBy default, the command palette is preloaded with most actions that might\nbe useful in an interactive setting yet do not have easily accessible or\nmemorizable shortcuts. The default entries can be restored by setting this\nsetting to an empty value:\n\n```ini\ncommand-palette-entry =\n```\n\nAvailable since: 1.2.0",
"defaults": [
"title:\"Change Tab Title\\xe2\\x80\\xa6\",description:\"Prompt for a new title for the current tab.\",action:\"prompt_tab_title\"",
"title:\"Change Terminal Title\\xe2\\x80\\xa6\",description:\"Prompt for a new title for the current terminal.\",action:\"prompt_surface_title\"",
"title:\"Change Tab Title…\",description:\"Prompt for a new title for the current tab.\",action:\"prompt_tab_title\"",
"title:\"Change Terminal Title…\",description:\"Prompt for a new title for the current terminal.\",action:\"prompt_surface_title\"",
"title:\"Change Window Title…\",description:\"Prompt for a new title for the current window.\",action:\"prompt_window_title\"",
"title:\"Check for Updates\",description:\"Check for updates to the application.\",action:\"check_for_updates\"",
"title:\"Clear Screen\",description:\"Clear the screen and scrollback.\",action:\"clear_screen\"",
"title:\"Close All Windows\",description:\"Close all windows.\",action:\"close_all_windows\"",
@@ -2102,14 +2184,16 @@
"title:\"Focus Split: Up\",description:\"Focus the split above, if it exists.\",action:\"goto_split:up\"",
"title:\"Focus Window: Next\",description:\"Focus the next window, if any.\",action:\"goto_window:next\"",
"title:\"Focus Window: Previous\",description:\"Focus the previous window, if any.\",action:\"goto_window:previous\"",
"title:\"Ghostty\",description:\"Put a little Ghostty in your terminal.\",action:\"text:\\xf0\\x9f\\x91\\xbb\"",
"title:\"Ghostty\",description:\"Put a little Ghostty in your terminal.\",action:\"text:👻\"",
"title:\"Increase Font Size\",description:\"Increase the font size by 1 point.\",action:\"increase_font_size:1\"",
"title:\"Move Tab Left\",description:\"Move the current tab to the left.\",action:\"move_tab:-1\"",
"title:\"Move Tab Right\",description:\"Move the current tab to the right.\",action:\"move_tab:1\"",
"title:\"Move Tab to New Window\",description:\"Move the current tab to a new window.\",action:\"move_tab_to_new_window\"",
"title:\"New Tab\",description:\"Open a new tab.\",action:\"new_tab\"",
"title:\"New Window\",description:\"Open a new window.\",action:\"new_window\"",
"title:\"Next Search Result\",description:\"Navigate to the next search result, if any.\",action:\"navigate_search:next\"",
"title:\"Open Config\",description:\"Open the config file.\",action:\"open_config\"",
"title:\"Open Config in New Terminal Window\",description:\"Open the config file in a new window using $EDITOR or $VISUAL.\",action:\"open_config:new_window\"",
"title:\"Open Config Using OS editor\",description:\"Open the config file with the OS's default editor.\",action:\"open_config:os_open\"",
"title:\"Paste from Clipboard\",description:\"Paste the contents of the main clipboard.\",action:\"paste_from_clipboard\"",
"title:\"Paste from Selection\",description:\"Paste the contents of the selection clipboard.\",action:\"paste_from_selection\"",
"title:\"Previous Search Result\",description:\"Navigate to the previous search result, if any.\",action:\"navigate_search:previous\"",
@@ -2170,6 +2254,40 @@
"false"
]
},
{
"key": "vt-window-resize-allowed",
"zigType": "bool",
"kind": "bool",
"doc": "If true, allows the running program to resize the window using the\nxterm `CSI 8 ; rows ; columns t` escape sequence. If a parameter is zero\nor omitted, the current size of that dimension is kept. Sizes smaller\nthan 40 columns by 10 rows are raised to that size so that a program\ncan't shrink the window to hide its output.\n\nThe request is ignored if the terminal is in a split, in a window with\nmultiple tabs, or the quick terminal, or if the window manager controls\nthe window size, such as when it is fullscreen, maximized, or tiled.\nSizes larger than the screen are clamped to the screen.\n\nThis is disabled by default because it lets any program, including one\nrunning on a remote machine, change the size of your window.\n\nAvailable since: 1.4.0",
"defaults": [
"false"
]
},
{
"key": "vt-xt-checksum-report",
"zigType": "bool",
"kind": "bool",
"doc": "Enables or disables checksum reporting (DECRQCRA, `CSI Pi ; Pg ; Pt ;\nPl ; Pb ; Pr * y`). This escape sequence allows the running program to\nask for a checksum of an area of the screen. Terminal test suites use it\nto check what is on the screen.\n\nThis is disabled by default because a program can ask for the checksum of\none cell at a time and so read back everything on the screen, including\nthe output of other programs.\n\nWhile this is disabled, XTCHECKSUM (`CSI Ps # y`), which changes how the\nchecksum is calculated, is ignored as well.\n\nAvailable since: 1.4.0",
"defaults": [
"false"
]
},
{
"key": "vt-xt-checksum-extension",
"zigType": "XtChecksumExtension",
"kind": "flags",
"flags": [
"negate",
"attributes",
"trim",
"undrawn",
"full"
],
"doc": "How the checksum reported for DECRQCRA (see `vt-xt-checksum-report`) is\ncalculated. This is the calculation used after a reset, like xterm's\n`checksumExtension` resource. A running program can change it with\nXTCHECKSUM (`CSI Ps # y`) until the next reset. The default is the\ncalculation of a real DEC terminal.\n\nValid values are:\n\n * `negate` - Report the negated sum, as DEC terminals do.\n\n * `attributes` - Add bold, underline, blink, inverse, invisible, and\n protected attributes to the value of each cell.\n\n * `trim` - Omit plain spaces other than the first cell of the area.\n\n * `undrawn` - Count cells that were never written to as spaces\n instead of skipping them.\n\n * `full` - Use the full codepoint of each cell instead of the DEC\n 8-bit value.\n\nPrefix a value with `no-` to disable it. For example, esctest expects\n`no-negate,no-attributes,no-trim,full` when run with `--xterm-checksum`,\nwhich is xterm's `checksumExtension: 23`.\n\nThe bits of xterm's resource are described in its\n[man page](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411/xterm.man#L2870-L2896)\nand its [control sequence documentation](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411/ctlseqs.ms#L2562-L2569),\nbut where those disagree with xterm's\n[implementation](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411/screen.c#L3162-L3290),\nGhostty follows the implementation. The documentation describes bit 3\nas omitting cells that were never written to, but xterm skips those\ncells by default and counts them as spaces with the bit set, which is\n`undrawn` here. It also lists a bit 5 that xterm doesn't implement.\n\nAvailable since: 1.4.0",
"defaults": [
"negate,attributes,trim,no-undrawn,no-full"
]
},
{
"key": "custom-shader",
"zigType": "RepeatablePath",
@@ -2543,6 +2661,15 @@
"top"
]
},
{
"key": "gtk-tabs-inverted",
"zigType": "bool",
"kind": "bool",
"doc": "If true, the close button of each tab is shown at the start of the tab\n(the left, in left-to-right languages) and the tab's icon at the end.\nThis applies to both the tab bar and the tab overview. GTK only.\n\nAvailable since: 1.4.0",
"defaults": [
"false"
]
},
{
"key": "gtk-titlebar-hide-when-maximized",
"zigType": "bool",
@@ -2588,6 +2715,15 @@
"true"
]
},
{
"key": "gtk-horizontal-tab-scroll",
"zigType": "bool",
"kind": "bool",
"doc": "If `true` (default), then two-finger horizontal scrolling on a touchpad\nwill switch between tabs. Scrolling left goes to the next tab and\nscrolling right goes to the previous tab. Set this to `false` to\ndisable this behavior.\n\nAvailable since 1.4.0.",
"defaults": [
"true"
]
},
{
"key": "gtk-custom-css",
"zigType": "RepeatablePath",
@@ -2707,5 +2843,67 @@
"doc": "The size of the quick terminal.\n\nThe size can be specified either as a percentage of the screen dimensions\n(height/width), or as an absolute size in pixels. Percentage values are\nsuffixed with `%` (e.g. `20%`) while pixel values are suffixed with `px`\n(e.g. `300px`). A bare value without a suffix is a config error.\n\nWhen only one size is specified, the size parameter affects the size of\nthe quick terminal on its *primary axis*, which depends on its position:\nheight for quick terminals placed on the top or bottom, and width for left\nor right. The primary axis of a centered quick terminal depends on the\nmonitor's orientation: height when on a landscape monitor, and width when\non a portrait monitor.\n\nThe *secondary axis* would be maximized for non-center positioned\nquick terminals unless another size parameter is specified, separated\nfrom the first by a comma (`,`). Percentage and pixel sizes can be mixed\ntogether: for instance, a size of `50%,500px` for a top-positioned quick\nterminal would be half a screen tall, and 500 pixels wide.\n\nAvailable since: 1.2.0",
"notListed": true
}
],
"compat": [
{
"key": "background-blur-radius",
"renamedTo": "background-blur"
},
{
"key": "adw-toolbar-style",
"renamedTo": "gtk-toolbar-style"
},
{
"key": "gtk-tabs-location",
"values": [
"hidden"
],
"sets": [
"window-show-tab-bar"
]
},
{
"key": "cursor-invert-fg-bg",
"sets": [
"cursor-color",
"cursor-text"
]
},
{
"key": "selection-invert-fg-bg",
"sets": [
"selection-foreground",
"selection-background"
]
},
{
"key": "bold-is-bright",
"sets": [
"bold-color"
]
},
{
"key": "gtk-single-instance",
"values": [
"desktop"
]
},
{
"key": "macos-dock-drop-behavior",
"values": [
"window"
]
},
{
"key": "scrollback-limit",
"renamedTo": "scrollback-limit-bytes"
},
{
"key": "copy-on-select",
"values": [
"true",
"false"
]
}
]
}
+54
View File
@@ -113,6 +113,60 @@ func TestValidate(t *testing.T) {
}
}
// Types and compatibility entries that arrived with Ghostty 1.4.
func TestGhostty14Options(t *testing.T) {
s, err := Embedded()
if err != nil {
t.Fatal(err)
}
cases := []struct {
key, value string
ok bool
}{
{"scrollback-limit-lines", "unlimited", true},
{"scrollback-limit-bytes", "100000000", true},
{"scrollback-limit-bytes", "-1", false},
{"clipboard-write-limit-bytes", "lots", false},
{"window-padding-balance", "equal", true},
{"window-padding-balance", "maybe", false},
{"copy-on-select", "both", true},
{"copy-on-select", "true", true}, // old value, still read
{"copy-on-select", "yes", false},
{"gtk-single-instance", "desktop", true},
}
for _, c := range cases {
o := s.Lookup(c.key)
if o == nil {
t.Fatalf("%s missing", c.key)
}
if err := o.Validate(c.value); (err == nil) != c.ok {
t.Errorf("%s = %q: err = %v, want ok=%v", c.key, c.value, err, c.ok)
}
}
if !s.Lookup("copy-on-select").IsOldValue("true") || s.Lookup("copy-on-select").IsOldValue("both") {
t.Error("copy-on-select: old values wrong")
}
if c := s.OldKey("scrollback-limit"); c == nil || c.RenamedTo != "scrollback-limit-bytes" {
t.Errorf("OldKey(scrollback-limit) = %+v", c)
}
if c := s.OldKey("bold-is-bright"); c == nil || c.RenamedTo != "" || len(c.Sets) != 1 || c.Sets[0] != "bold-color" {
t.Errorf("OldKey(bold-is-bright) = %+v", c)
}
if s.OldKey("copy-on-select") != nil {
t.Error("a current option is not an old key")
}
if got := s.OldNames("scrollback-limit-bytes"); len(got) != 1 || got[0] != "scrollback-limit" {
t.Errorf("OldNames(scrollback-limit-bytes) = %v", got)
}
// Refreshing from the installed Ghostty keeps the old values.
s.Refresh("# Copy\ncopy-on-select = none\n", "1.4.0")
if !s.Lookup("copy-on-select").IsOldValue("false") {
t.Error("old values lost on refresh")
}
}
func TestFlags(t *testing.T) {
o := &Option{Kind: KindFlags, Flags: []string{"cursor", "sudo", "title"}, Defaults: []string{"cursor,no-sudo,title"}}
st := o.ParseFlags("no-cursor")
+6
View File
@@ -35,6 +35,9 @@ func (o *Option) Validate(raw string) error {
// An empty value resets the option to its default; always allowed.
return nil
}
if contains(o.OldValues, v) {
return nil
}
switch o.Kind {
case KindBool:
if v != "true" && v != "false" {
@@ -47,6 +50,9 @@ func (o *Option) Validate(raw string) error {
case KindFlags:
return o.validateFlags(v)
case KindInt:
if contains(o.Values, v) { // e.g. "unlimited"
return nil
}
n, err := strconv.ParseInt(v, 10, 64)
if err != nil {
return errors.New("expected a whole number")
+57 -8
View File
@@ -195,14 +195,62 @@ func (a *App) option(key string) *schema.Option {
Kind: schema.KindText,
Repeatable: len(a.file.GetAll(key)) > 1,
Category: catSet,
Doc: "This key is not a known Ghostty " + a.sch.GhosttyVersion + " option. " +
}
v := a.sch.GhosttyVersion
switch c := a.sch.OldKey(key); {
case c != nil && c.RenamedTo != "":
o.Doc = "This is the old name of `" + c.RenamedTo + "`. Ghostty " + v + " still reads it, " +
"so it keeps working, but it is no longer documented. " +
"Press enter to rename it to `" + c.RenamedTo + "`; the value stays as it is."
if n := a.sch.Lookup(c.RenamedTo); n != nil && n.Doc != "" {
o.Doc += "\n\n" + n.Doc
}
case c != nil:
o.Doc = "This is an old option that Ghostty " + v + " still reads for compatibility. " +
"It now sets `" + strings.Join(c.Sets, "`, `") + "` instead. " +
"Set those directly, then press r to remove this line."
default:
o.Doc = "This key is not a known Ghostty " + v + " option. " +
"It may be misspelled or belong to a different Ghostty version. " +
"Ghostty will report it as an error; press r to remove it.",
"Ghostty will report it as an error; press r to remove it."
}
a.unknown[key] = o
return o
}
// oldName returns the old key under which the file sets o, and its value.
func (a *App) oldName(o *schema.Option) (key, value string, ok bool) {
for _, old := range a.sch.OldNames(o.Key) {
if v, found := a.file.Get(old); found {
key, value, ok = old, v, true
}
}
return key, value, ok
}
// renameKey gives the entries of an old key their current name, keeping
// their values and their place in the file, and selects the result.
func (a *App) renameKey(old, new string) {
before := a.file.Clone()
a.file.Rename(old, new)
a.pushUndo(before, old)
a.setStatus("Renamed "+old+" to "+new+".", stChanged)
a.rebuild()
for i, o := range a.opts {
if o.Key == new {
a.optIdx = i
}
}
}
func (a *App) pushUndo(before *config.File, key string) {
a.rev++
a.undo = append(a.undo, undoEntry{file: before, key: key})
if len(a.undo) > 500 {
a.undo = a.undo[1:]
}
}
func (a *App) selected() *schema.Option {
if a.optIdx >= 0 && a.optIdx < len(a.opts) {
return a.opts[a.optIdx]
@@ -516,8 +564,13 @@ func (a *App) updateBrowse(km tea.KeyMsg) tea.Cmd {
return nil
}
// edit opens the editor for o. Booleans are toggled directly.
// edit opens the editor for o. Booleans are toggled directly, and the old
// name of an option is renamed to the current one.
func (a *App) edit(o *schema.Option) tea.Cmd {
if c := a.sch.OldKey(o.Key); c != nil && c.RenamedTo != "" {
a.renameKey(c.Key, c.RenamedTo)
return nil
}
if o.Kind == schema.KindBool && !o.Repeatable {
a.quickToggle(o)
return nil
@@ -693,11 +746,7 @@ func (a *App) apply(o *schema.Option, res *result) {
if a.file.Equal(before) {
return
}
a.rev++
a.undo = append(a.undo, undoEntry{file: before, key: o.Key})
if len(a.undo) > 500 {
a.undo = a.undo[1:]
}
a.pushUndo(before, o.Key)
switch {
case res.values == nil:
a.setStatus("Reset "+o.Key+" to its default.", stChanged)
+47
View File
@@ -243,3 +243,50 @@ func TestUpdateHintShown(t *testing.T) {
t.Errorf("header without an update: %q", h)
}
}
func TestOldNameIsRenamed(t *testing.T) {
a := newTestApp(t, "# big scrollback\nscrollback-limit = 100000000\n")
a.selectCategory(0)
old := a.selected()
if old == nil || old.Key != "scrollback-limit" {
t.Fatalf("selected = %v", old)
}
if doc := ansi.Strip(a.docContent(old, 100)); !strings.Contains(doc, "old name of") || strings.Contains(doc, "misspelled") {
t.Errorf("doc of the old name:\n%s", doc)
}
// The current option shows the value set under its old name.
doc := ansi.Strip(a.docContent(a.sch.Lookup("scrollback-limit-bytes"), 100))
if !strings.Contains(doc, "100000000 ● set as scrollback-limit") || !strings.Contains(doc, "also reads the old name") {
t.Errorf("doc of the new name:\n%s", doc)
}
press(a, "enter")
if got := string(a.file.Bytes()); got != "# big scrollback\nscrollback-limit-bytes = 100000000\n" {
t.Fatalf("after rename:\n%s", got)
}
if o := a.selected(); o == nil || o.Key != "scrollback-limit-bytes" {
t.Errorf("selected after rename = %v", o)
}
press(a, "u")
if !a.file.Has("scrollback-limit") || a.dirty() {
t.Error("undo did not restore the old name")
}
}
func TestOldValueAndReplacedOption(t *testing.T) {
a := newTestApp(t, "copy-on-select = true\nbold-is-bright = true\n")
doc := ansi.Strip(a.docContent(a.sch.Lookup("copy-on-select"), 100))
if strings.Contains(doc, "invalid") || !strings.Contains(doc, "an old value") || !strings.Contains(doc, "none, primary, clipboard, both") {
t.Errorf("doc of copy-on-select = true:\n%s", doc)
}
doc = ansi.Strip(a.docContent(a.option("bold-is-bright"), 100))
if !strings.Contains(doc, "now sets bold-color") || strings.Contains(doc, "misspelled") {
t.Errorf("doc of bold-is-bright:\n%s", doc)
}
// Not renamed: enter edits the line as text.
a.selectCategory(0)
press(a, "down", "enter")
if a.editor == nil {
t.Error("enter on a replaced option opens no editor")
}
}
+30 -2
View File
@@ -204,6 +204,8 @@ func (a *App) renderOpts(w, h int) string {
selected := i == a.optIdx
keySt := lipgloss.NewStyle()
switch {
case a.sch.OldKey(o.Key) != nil:
keySt = stChanged // still read by Ghostty, but no longer documented
case a.unknown[o.Key] == o:
keySt = stError
case o.Platform != "" && a.osName != "" && o.Platform != a.osName:
@@ -294,6 +296,8 @@ func (a *App) valueSegs(o *schema.Option, w int) []seg {
if o.Validate(v) != nil {
st = stError
}
} else if _, ov, ok := a.oldName(o); ok {
v, st = ov, stChanged // set under the option's old name
}
if v == "" {
return []seg{styled("—", stDim)}
@@ -370,6 +374,12 @@ func (a *App) docContent(o *schema.Option, w int) string {
row := func(label, value string) {
b.WriteString(stLabel.Render(label) + " " + ansi.Wrap(value, max(10, w-10), "") + "\n")
}
// note is an indented remark below the value, wrapped to the panel.
note := func(st lipgloss.Style, text string) {
for _, l := range strings.Split(ansi.Wrap(text, max(10, w-10), ""), "\n") {
b.WriteString(" " + st.Render(l) + "\n")
}
}
if a.editor == nil {
row("Type", o.TypeLabel())
vals := a.file.GetAll(o.Key)
@@ -401,9 +411,13 @@ func (a *App) docContent(o *schema.Option, w int) string {
def = sw + " " + def
}
row("Default", strings.ReplaceAll(def, "\t", "\\t"))
if len(vals) == 0 {
oldKey, oldVal, hasOld := a.oldName(o)
switch {
case len(vals) == 0 && hasOld:
row("Value", oldVal+" "+stChanged.Render("● set as "+oldKey))
case len(vals) == 0:
row("Value", stDim.Render("not set (uses default)"))
} else {
default:
v := vals[len(vals)-1]
if sw := swatch(v); sw != "" && o.Kind == schema.KindColor {
v = sw + " " + v
@@ -411,11 +425,25 @@ func (a *App) docContent(o *schema.Option, w int) string {
row("Value", v+" "+stSet.Render("● set in config"))
if err := o.Validate(vals[len(vals)-1]); err != nil {
b.WriteString(stError.Render(" ✗ invalid: "+err.Error()) + "\n")
} else if o.IsOldValue(vals[len(vals)-1]) {
text := "an old value; Ghostty " + a.sch.GhosttyVersion + " still reads it"
if len(o.Values) > 0 {
text += ", but the current values are " + strings.Join(o.Values, ", ")
}
note(stChanged, text)
}
if len(vals) > 1 {
b.WriteString(stChanged.Render(fmt.Sprintf(" set %d times; the last one wins", len(vals))) + "\n")
}
}
if hasOld {
text := "Ghostty also reads the old name " + oldKey + " as this option. " +
"Select it under " + catSet + " and press enter to rename it."
if len(vals) > 0 {
text += " As both are set, the line further down wins."
}
note(stChanged, text)
}
}
if o.Platform != "" {
row("Platform", o.Platform+" only")