summaryrefslogtreecommitdiff
path: root/src/cli
AgeCommit message (Collapse)Author
2025-10-03Zig 0.15: zig build test Mitchell Hashimoto
2025-10-03Zig 0.15: zig fmtMitchell Hashimoto
2025-09-29config: modify MouseScrollMultiplier to lean on args parsingMitchell Hashimoto
2025-09-24cli: use sh to launch editorJeffrey C. Ollie
2025-09-23rename Splitter-CommaSplitterJeffrey C. Ollie
2025-09-23config: smarter parsing in autoParseStructJeffrey C. Ollie
Fixes #8849 Previously, the `parseAutoStruct` function that was used to parse generic structs for the config simply split the input value on commas without taking into account quoting or escapes. This led to problems because it was impossible to include a comma in the value of config entries that were parsed by `parseAutoStruct`. This is particularly problematic because `ghostty +show-config --default` would produce output like the following: ``` command-palette-entry = title:Focus Split: Next,description:Focus the next split, if any.,action:goto_split:next ``` Because the `description` contains a comma, Ghostty is unable to parse this correctly. The value would be split into four parts: ``` title:Focus Split: Next description:Focus the next split if any. action:goto_split:next ``` Instead of three parts: ``` title:Focus Split: Next description:Focus the next split, if any. action:goto_split:next ``` Because `parseAutoStruct` simply looked for commas to split on, no amount of quoting or escaping would allow that to be parsed correctly. This is fixed by (1) introducing a parser that will split the input to `parseAutoStruct` into fields while taking into account quotes and escaping. And (2) changing the `ghostty +show-config` output to put the values in `command-palette-entry` into quotes so that Ghostty can parse it's own output. `parseAutoStruct` will also now parse double quoted values as a Zig string literal. This makes it easier to embed control codes, whitespace, and commas in values.
2025-09-22feat: list-themes cursor and selection colorsCoderJoshDK
2025-09-05gtk-ng: deprecate detection of launch sourceJeffrey C. Ollie
Detecting the launch source frequently failed because various launchers fail to sanitize the environment variables that Ghostty used to detect the launch source. For example, if your desktop environment was launched by `systemd`, but your desktop environment did not sanitize the `INVOCATION_ID` or the `JOURNAL_STREAM` environment variables, Ghostty would assume that it had been launched by `systemd` and behave as such. This led to complaints about Ghostty not creating new windows when users expected that it would. To remedy this, Ghostty no longer does any detection of the launch source. If your launch source is something other than the CLI, it must be explicitly speciflied on the CLI. All of Ghostty's default desktop and service files do this. Users or packagers that create custom desktop or service files will need to take this into account. On GTK, the `desktop` setting for `gtk-single-instance` is replaced with `detect`. `detect` behaves as `gtk-single-instance=true` if one of the following conditions is true: 1. If no CLI arguments have been set. 2. If `--launched-from` has been set to `desktop`, `dbus`, or `systemd`. Otherwise `detect` behaves as `gtk-single-instance=false`.
2025-09-05gtk: the Future is NowLeah Amelia Chen
2025-09-05gtk: nuke the legacy apprt from orbitLeah Amelia Chen
We don't really have any large outstanding regressions on -ng to warrant keeping this alive anymore. ¡Adiós!
2025-08-25cli: show colors in +list-colors if possibleJeffrey C. Ollie
Fixes #8386 This is a fairly simple implementaion, there's no interactivity or searching. It will adapt the number of columns to the available width of the display though. Will fallback to a plain text dump if there's no tty or the `--plain` argument is specified on the CLI.
2025-07-30cli: update var nameAnthony
2025-07-27cli: add filtering hotkey to list_themesAnthony
2025-07-14windows: get +ssh-cache building on WindowsJeffrey C. Ollie
There are still problems linking due to `gettext`. No idea if this actually _works_ on Windows. File locking had to be disabled on Windows because of a bug in the Zig std library. Adding all of the explicit error sets happened due to disabling file locking. Fixing permissions had to be disabled on Windows as the Windows file system does not support permissions in the way that POSIX systems like macOS and Linux do.
2025-07-14cli/gtk: move IPC/sendIPC to App/performIpcJeffrey C. Ollie
2025-07-14cli/gtk: remove --release and --debug flags, use optional for argumentsJeffrey C. Ollie
2025-07-14cli/gtk: replace @hasDecl for performAction-style APIJeffrey C. Ollie
Instead of using @hasDecl, use a performAction-stype API. The C interface for interfacing with macOS (or any other apprt where Ghostty is embedded) is unfinished.
2025-07-14cli/gtk: move actual IPC code tp apprtJeffrey C. Ollie
2025-07-14cli/gtk: add -e to +new-windowJeffrey C. Ollie
This adds the `-e` flag to the `+new-window` CLI action. This allows a command to be passed from the CLI to the running instance of Ghostty. Nothing is done with that command besides logging its presence.
2025-07-14cli/gtk: move GTK-specific code to a new file in a subdirectoryJeffrey C. Ollie
2025-07-14cli/gtk: clarify +new-window documentation and improve instance discoveryJeffrey C. Ollie
- Add a `GHOSTTY_CLASS` environment variables to any command executed by Ghostty to make discovering the correct application ID easier. - Add a flag to force the relelase application ID. - Ensure that CLI flags to `+new-window` are mutually exclusive. - Fix documentation about D-Bus activation requirements.
2025-07-14cli/gtk: add +new-window actionJeffrey C. Ollie
This will (on GTK) use a D-Bus method call to tell a running Ghostty instance to open a new window. If D-Bus activation is configured properly, Ghostty does not need to be running first. This could be extended to other platforms, e.g. AppleScript on macOS eventually. When Ghostty develops a native API, that could be used instead to create a new window.
2025-07-09cli: make the action parser (+foo) generic and reusableMitchell Hashimoto
2025-07-09cli: rewrite ssh-cache diskcache and test IOMitchell Hashimoto
2025-07-09cli: ssh-cache stylistic changesMitchell Hashimoto
2025-07-09cli: fix macOS buildsMitchell Hashimoto
2025-07-07Merge branch 'main' into ssh-integrationJason Rayne
2025-07-05fix: replace custom const with std lib, remove dead-weight testJason Rayne
- Replaced custom const `SECONDS_PER_DAY` with `std.time.s_per_day` - Removed concurrent access test - would need real file ops to be meaningful
2025-07-03tests: use ! operator instead of == false for consistencyJason Rayne
Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-07-03Merge branch 'main' into ssh-integrationJason Rayne
2025-07-03feat(ssh): rewrite SSH cache system in native ZigJason Rayne
- Eliminates standalone bash dependency - Consolidates `+list-ssh-cache` and `+clear-ssh-cache` actions into single `+ssh-cache` action with args - Structured cache format with timestamps and expiration support - Memory-safe entry handling with proper file locking - Comprehensive hostname validation (IPv4/IPv6/domains) - Atomic updates via temp file + rename - Updated shell integrations for improved cross-platform support and reliability - Cache operations are now unit-testable
2025-07-04Add linux kernel information to +versionBartosz Sokorski
2025-06-28config: fix regression where we halted parsing on deprecated fieldMitchell Hashimoto
Fix regression from d44a6cde2c7ed59f0f28fad16e6b760d7529ebee where we halted parsing on deprecated fields, which was not the intended behavior. This commit fixes that and adds a test to verify it.
2025-06-28config: more general purpose backwards compatibility handlers (#7717)Mitchell Hashimoto
Fixes #7706 We previously had a very specific backwards compatibility handler for handling renamed fields. We always knew that wouldn't scale but I wanted to wait for a real case. Well, #7706 is a real case, so here we are. This commit makes our backwards compatibility handler more general purpose, and makes a special-case handler for renamed fields built on top of this same general purpose system. The new system lets us do a lot more with regards to backwards compatibility. To start, this addresses #7706 by allowing us to handle a removed single enum value of a still-existing field. In the future, I think this may continue to get _more_ general purpose by moving the handlers from functions to structs so we can have more metadata like descriptions and so on that we may use to generate docs or other help strings.
2025-06-28config: more general purpose backwards compatibility handlersMitchell Hashimoto
Fixes #7706 We previously had a very specific backwards compatibility handler for handling renamed fields. We always knew that wouldn't scale but I wanted to wait for a real case. Well, #7706 is a real case, so here we are. This commit makes our backwards compatibility handler more general purpose, and makes a special-case handler for renamed fields built on top of this same general purpose system. The new system lets us do a lot more with regards to backwards compatibility. To start, this addresses #7706 by allowing us to handle a removed single enum value of a still-existing field.
2025-06-28fix: enable `boo` on FreeBSD-k
2025-06-25fix: correct resources directory fallback path and eliminate code ↵Jason Rayne
duplication in ssh_cache - Fix fallback path from full path to "src" since full path is built later - Extract duplicate code from listCachedHosts and clearCache into runCacheCommand helper - Addresses feedback from @00-kat
2025-06-25fix: use imported modules consistently in action dispatchJason Rayne
2025-06-25docs: improve clear-ssh-cache description (missed in previous commit)Jason Rayne
Clarifies this clears hosts cached by SSH shell integration, completing mitchellh's feedback on both action descriptions.
2025-06-25docs: improve SSH cache CLI action descriptionsJason Rayne
- Clarify that +list-ssh-cache shows shell integration cached hosts - Add note about +clear-ssh-cache command and when to use it Addresses mitchellh's feedback on action descriptions.
2025-06-25refactor: replace ghostty wrapper with proper CLI actions for terminfo cache ↵Jason Rayne
management - Add +list-ssh-cache and +clear-ssh-cache CLI actions - Remove ghostty() wrapper functions from all shell integrations - Improve variable naming in shell scripts for readability Addresses @00-kat's feedback about CLI discoverability and naming consistency. The new CLI actions follow established Ghostty patterns and are discoverable via `ghostty --help`, while maintaining clean separation of concerns between shell logic and cache management.
2025-06-24core, gtk: implement host resources dir for FlatpakLeorize
Introduces host resources directory as a new concept: A directory containing application resources that can only be accessed from the host operating system. This is significant for sandboxed application runtimes like Flatpak where shells spawned on the host should have access to application resources to enable integrations. Alongside this, apprt is now allowed to override the resources lookup logic.
2025-06-24cli: +edit-config command to open the config file in $EDITORMitchell Hashimoto
This adds a new CLI `ghostty +edit-config`. This will open the config file in the user's specified `$EDITOR`. If Ghostty has never been configured, this will also create the initial config file with some default templated contents (the same as that which we introduced back in Ghostty 1.0.1 or something -- not new behavior here). This is useful on its own because it will find the correct configuration path to open. If users are terminal users anyway (not a big stretch since this is a terminal app), this will allow them to easily edit config right away. This is also forward looking: I want to replace our "Open Config" action to open a Ghostty window executing this command so that users can edit their config in a terminal editor. This has been heavily requested since forever (short of a full GUI settings editor, which is not ready yet). I don't do this in this PR but plan to in a future PR.
2025-06-22`input` configuration to pass input as stdin on startupMitchell Hashimoto
This adds a new configuration `input` that allows passing either raw text or file contents as stdin when starting the terminal. The input is sent byte-for-byte to the terminal, so control characters such as `\n` will be interpreted by the shell and can be used to run programs in the context of the loaded shell. Example: `ghostty --input="hello, world\n"` will start the your default shell, run `echo hello, world`, and then show the prompt.
2025-05-27Miscellaneous `TODO`s (#7451)Mitchell Hashimoto
See commit messages for details. If some of the commits in this PR have problems with them I'm perfectly fine with the others being cherry-picked out while the problems are addressed. The biggest/broadest reaching changes in this PR come from converting a lot of code to use decl literals where possible, so there are a lot of files where only a handful of lines are modified very slightly.
2025-05-27Correct `$XDG_CONFIG_DIR` to `$XDG_CONFIG_HOME` in theme documentation.Kat
2025-05-26style: use decl literalsQwerasd
This commit changes a LOT of areas of the code to use decl literals instead of redundantly referring to the type. These changes were mostly driven by some regex searches and then manual adjustment on a case-by-case basis. I almost certainly missed quite a few places where decl literals could be used, but this is a good first step in converting things, and other instances can be addressed when they're discovered. I tested GLFW+Metal and building the framework on macOS and tested a GTK build on Linux, so I'm 99% sure I didn't introduce any syntax errors or other problems with this. (fingers crossed)
2025-05-09apprt/glfw: buildsMitchell Hashimoto
2025-05-01use enum for the color scheme argsMaciej Bartczak
2025-05-01implement dark/light theme filtering in theme previewMaciej Bartczak