Fixes #2181 - Adds configuration manager - #2363
Merged
Merged
Conversation
This was referenced Apr 30, 2026
This was referenced May 11, 2026
This was referenced May 21, 2026
This was referenced May 28, 2026
This was referenced Jun 15, 2026
This was referenced Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've deleted #2284 and replaced it with this, targetting v2.
Fixes #2181
Fixes #29
Adds a Configuration Manager.
Configuration Management
Terminal.Gui provides configuration and theme management for Terminal.Gui applications via the [
ConfigurationManager](~/api/Terminal.Gui/Terminal.Gui.Configuration.Applicationclass. Settings are accessed via theSettingsproperty of theConfigurationManagerclass.ConfigurationManagerto store and retrieve application-specific settings.The The
ConfigurationManagerwill look for configuration files in the.tuifolder in the user's home directory (e.g.C:/Users/username/.tuior/usr/username/.tui), the folder where the Terminal.Gui application was launched from (e.g../.tui), or as a resource within the Terminal.Gui application's main assembly.Settings that will apply to all applications (global settings) reside in files named config.json. Settings that will apply to a specific Terminal.Gui application reside in files named appname.config.json, where appname is the assembly name of the application (e.g.
UICatalog.config.json).Settings are applied using the following precedence (higher precedence settings overwrite lower precedence settings):
App specific settings found in the users's home directory (
~/.tui/appname.config.json). -- Highest precedence.App specific settings found in the directory the app was launched from (
./.tui/appname.config.json).App settings in app resources (
Resources/config.json).Global settings found in the the user's home directory (
~/.tui/config.json).Global settings found in the directory the app was launched from (
./.tui/config.json).Default settings defined in the Terminal.Gui assembly -- Lowest precedence.
The
UI Catalogapplication provides an example of how to use theConfigurationManagerclass to load and save configuration files. TheConfiguration Editorscenario provides an editor that allows users to edit the configuration files. UI Catalog also uses a file system watcher to detect changes to the configuration files to tellConfigurationManagerto reaload them; allowing users to change settings without having to restart the application.What Can Be Configured
Settings
Settings for the
Applicationclass.* QuitKey
* AlternateForwardKey
* AlternateBackwardKey
* UseSystemConsole
* IsMouseDisabled
* HeightAsBuffer
Themes
A Theme is a named collection of settings that impact the visual style of Terminal.Gui applications. The default theme is named "Default". The built-in configuration stored within the Terminal.Gui library defines two more themes: "Dark", and "Light". Additional themes can be defined in the configuration files.
The Json property
Themedefines the name of the theme that will be used. If the theme is not found, the default theme will be used.Themes support defining ColorSchemes as well as various default settings for Views. Both the default color schemes and user defined color schemes can be configured. See ColorSchemes for more information.
Example Configuration File
{ "$schema": "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json", "Application.QuitKey": { "Key": "Esc" }, "AppSettings": { "UICatalog.StatusBar": false }, "Theme": "UI Catalog Theme", "Themes": [ { "UI Catalog Theme": { "ColorSchemes": [ { "UI Catalog Scheme": { "Normal": { "Foreground": "White", "Background": "Green" }, "Focus": { "Foreground": "Green", "Background": "White" }, "HotNormal": { "Foreground": "Blue", "Background": "Green" }, "HotFocus": { "Foreground": "BrightRed", "Background": "White" }, "Disabled": { "Foreground": "BrightGreen", "Background": "Gray" } } }, { "TopLevel": { "Normal": { "Foreground": "DarkGray", "Background": "White" ... } } } ], "Dialog.DefaultEffect3D": false } } ] }Configuration File Schema
Settings are defined in JSON format, according to the schema found here:
https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json
Current PR Status
Latest:
[SerializableConfigurationProperty]AppSettingsso apps can use CM for app-specific settingsBorderWhat's Missing:
ConsoleDriversuch that default glyphs can be configured (e.g.Driver.LeftBracketorDriver.VLineConsoleDriver.DiagnosticFlagsCollectionNavigator.TypingDelayCommands to be configured externally!KeyBindings to be configured externally!