-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #2181 - Adds configuration manager #2284
Closed
Closed
Conversation
This file contains 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
…lted in splitter getting stuck at some points).
Fixes & enhancments to SplitContainer
8 tasks
Closing; targetting v2 with #2362 instead. |
This was referenced Feb 20, 2023
8 tasks
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.
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.Application
class. Settings are accessed via theSettings
property of theConfigurationManager
class.ConfigurationManager
to store and retrieve application-specific settings.The The
ConfigurationManager
will look for configuration files in the.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 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 Catalog
application provides an example of how to use theConfigurationManager
class to load and save configuration files. TheConfiguration Editor
scenario 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 tellConfigurationManager
to reaload them; allowing users to change settings without having to restart the application.What Can Be Configured
Settings
Settings for the
Application
class.* 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
Theme
defines 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
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]
AppSettings
so apps can use CM for app-specific settingsBorder
What's Missing:
ConsoleDriver
such that default glyphs can be configured (e.g.Driver.LeftBracket
orDriver.VLine
ConsoleDriver.DiagnosticFlags
CollectionNavigator.TypingDelay
Command
s to be configured externally!KeyBinding
s to be configured externally!