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.The configuration object to free.
ghostty_config_clone
Creates a deep copy of a configuration object.The configuration to clone.
Loading Configuration
ghostty_config_load_default_files
Loads configuration from default file locations.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.The configuration object to load into.
Path to the configuration file.
ghostty_config_load_cli_args
Loads configuration from command-line arguments.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).The configuration object to load into.
import directives in the configuration files.
ghostty_config_finalize
Finalizes the configuration, applying defaults and validating settings.The configuration object to finalize.
Querying Configuration
ghostty_config_get
Retrieves a configuration value by key.The configuration object to query.
Pointer to store the result. The type depends on the configuration key.
The configuration key name.
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.The configuration object to query.
The action name.
Length of the action string.
Diagnostics
ghostty_config_diagnostics_count
Returns the number of configuration diagnostics (errors/warnings).The configuration object to check.
ghostty_config_get_diagnostic
Retrieves a diagnostic message by index.The configuration object to query.
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.Pointer to array of colors.
Number of colors in the array.
ghostty_config_palette_s
A 256-color palette.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.Primary dimension (width for horizontal, height for vertical).
Secondary dimension (height for horizontal, width for vertical).
Complete Example
See Also
- Core Types - Configuration-related types
- Ghostty Configuration - Available configuration options