Table of Contents

Class ConfigurationManager

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Provides settings and configuration management for Terminal.Gui applications.

Users can set Terminal.Gui settings on a global or per-application basis by providing JSON formatted configuration files. The configuration files can be placed in at .tui folder in the user's home directory (e.g. C:/Users/username/.tui, or /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 are defined in JSON format, according to this schema: https://gui-cs.github.io/Terminal.GuiV2Docs/schemas/tui-config-schema.json

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):

1. Application configuration found in the users' home directory (~/.tui/appname.config.json) -- Highest precedence

2. Application configuration found in the directory the app was launched from ( ./.tui/appname.config.json).

3. Application configuration found in the applications' resources (Resources/config.json).

4. Global configuration found in the user's home directory (~/.tui/config.json).

5. Global configuration found in the directory the app was launched from (./.tui/config.json).

6. Global configuration in Terminal.Gui.dll's resources (Terminal.Gui.Resources.config.json) -- Lowest Precedence.

public static class ConfigurationManager
Inheritance
ConfigurationManager
Inherited Members

Properties

AppName

Name of the running application. By default, this property is set to the application's assembly name.

AppSettings

Application-specific configuration settings scope.

Glyphs

The set of glyphs used to draw checkboxes, lines, borders, etc...See also GlyphDefinitions.

Locations

Gets and sets the locations where ConfigurationManager will look for config files. The value is All.

Settings

The root object of Terminal.Gui configuration settings / JSON schema. Contains only properties with the SettingsScope attribute value.

Themes

The root object of Terminal.Gui themes manager. Contains only properties with the ThemeScope attribute value.

ThrowOnJsonErrors

Gets or sets whether the ConfigurationManager should throw an exception if it encounters an error on deserialization. If false (the default), the error is logged and printed to the console when Shutdown() is called.

Methods

Apply()

Applies the configuration settings to the running Application instance.

GetEmptyJson()

Returns an empty Json document with just the $schema tag.

Load(bool)

Loads all settings found in the various configuration storage locations to the ConfigurationManager. Optionally, resets all settings attributed with SerializableConfigurationProperty to the defaults.

OnApplied()

Called when an updated configuration has been applied to the application. Fires the Applied event.

OnUpdated()

Called when the configuration has been updated from a configuration file. Invokes the Updated event.

PrintJsonErrors()

Prints any Json deserialization errors that occurred during deserialization to the console.

Reset()

Resets the state of ConfigurationManager. Should be called whenever a new app session (e.g. in Init(ConsoleDriver?, string?) starts. Called by Load(bool) if the reset parameter is true.

Events

Applied

Event fired when an updated configuration has been applied to the application.

Updated

Event fired when the configuration has been updated from a configuration source. application.