Configuration API
The libghostty configuration API provides functions for creating, loading, and managing terminal configuration.Creating Configuration
ghostty_config_new
Creates a new configuration object with default values.ghostty_config_free().
Example:
ghostty_config_free
Frees a configuration object.ghostty_config_t
required
The configuration object to free.
ghostty_config_clone
Creates a deep copy of a configuration object.ghostty_config_t
required
The configuration to clone.
Loading Configuration
ghostty_config_load_default_files
Loads configuration from default file locations.ghostty_config_t
required
The configuration object to load into.
$XDG_CONFIG_HOME/ghostty/config(or~/.config/ghostty/configifXDG_CONFIG_HOMEis not set)- Platform-specific locations
ghostty_config_load_file
Loads configuration from a specific file.ghostty_config_t
required
The configuration object to load into.
const char*
required
Path to the configuration file.
ghostty_config_load_cli_args
Loads configuration from command-line arguments.ghostty_config_t
required
The configuration object to load into.
ghostty_init() and applies them to the configuration.
Example:
ghostty_config_load_recursive_files
Loads configuration from files recursively (e.g., imports).ghostty_config_t
required
The configuration object to load into.
import directives in the configuration files.
ghostty_config_finalize
Finalizes the configuration, applying defaults and validating settings.ghostty_config_t
required
The configuration object to finalize.
Querying Configuration
ghostty_config_get
Retrieves a configuration value by key.ghostty_config_t
required
The configuration object to query.
void*
required
Pointer to store the result. The type depends on the configuration key.
const char*
required
The configuration key name.
uintptr_t
required
Length of the key string.
true if the key exists and was retrieved successfully, false otherwise.
Example:
ghostty_config_trigger
Retrieves the trigger (keybinding) for an action.ghostty_config_t
required
The configuration object to query.
const char*
required
The action name.
uintptr_t
required
Length of the action string.
Diagnostics
ghostty_config_diagnostics_count
Returns the number of configuration diagnostics (errors/warnings).ghostty_config_t
required
The configuration object to check.
ghostty_config_get_diagnostic
Retrieves a diagnostic message by index.ghostty_config_t
required
The configuration object to query.
uint32_t
required
Index of the diagnostic (0-based).
Utilities
ghostty_config_open_path
Returns the path to the configuration file that would be opened.ghostty_string_free().
Example:
Configuration Types
ghostty_config_color_list_s
A list of colors.const ghostty_config_color_s*
Pointer to array of colors.
size_t
Number of colors in the array.
ghostty_config_palette_s
A 256-color palette.ghostty_config_color_s[256]
Array of 256 colors (standard terminal color palette).
ghostty_config_command_list_s
A list of commands.ghostty_quick_terminal_size_tag_e
Quick terminal size specification type.ghostty_quick_terminal_size_s
Quick terminal size specification.ghostty_config_quick_terminal_size_s
Quick terminal size configuration.ghostty_quick_terminal_size_s
Primary dimension (width for horizontal, height for vertical).
ghostty_quick_terminal_size_s
Secondary dimension (height for horizontal, width for vertical).
Complete Example
See Also
- Core Types - Configuration-related types
- Ghostty Configuration - Available configuration options