Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Vty supports a configuration file format and associated Config
data type. The Config
can be provided to mkVty
to customize the
application's use of Vty.
Lines in config files that fail to parse are ignored. Later entries take precedence over earlier ones.
Debug
debugLog
Format:
"debugLog" string
The value of the environment variable VTY_DEBUG_LOG
is equivalent
to a debugLog entry at the end of the last config file.
Input Processing
map
Format:
"map" term string key modifier_list
where
key := KEsc | KChar Char | KBS ... (same as Key
)
modifier_list := "[" modifier+ "]"
modifier := MShift | MCtrl | MMeta | MAlt
term := "_" | string
E.g., if the contents are
map _ "\ESC[B" KUp [] map _ "\ESC[1;3B" KDown [MAlt] map "xterm" "\ESC[D" KLeft []
Then the bytes "\ESC[B"
will result in the KUp event on all
terminals. The bytes "\ESC[1;3B"
will result in the event KDown
with the MAlt modifier on all terminals. The bytes "\ESC[D"
will
result in the KLeft event when TERM
is xterm
.
If a debug log is requested then vty will output the current input
table to the log in the above format. A workflow for using this is
to set VTY_DEBUG_LOG
. Run the application. Check the debug log for
incorrect mappings. Add corrected mappings to $HOME.vtyconfig
.
- type InputMap = [(Maybe String, String, Event)]
- data Config = Config {}
- data VtyConfigurationError = VtyMissingTermEnvVar
- userConfig :: IO Config
- overrideEnvConfig :: IO Config
- standardIOConfig :: IO Config
- runParseConfig :: String -> ByteString -> Config
- parseConfigFile :: FilePath -> IO Config
- defaultConfig :: Config
Documentation
type InputMap = [(Maybe String, String, Event)] Source #
Mappings from input bytes to event in the order specified. Later entries take precedence over earlier in the case multiple entries have the same byte string.
A Vty configuration.
Config | |
|
data VtyConfigurationError Source #
Type of errors that can be thrown when configuring VTY
VtyMissingTermEnvVar | TERM environment variable not set |
userConfig :: IO Config Source #
Load a configuration from
and
getAppUserDataDirectory
/config$VTY_CONFIG_FILE
.
standardIOConfig :: IO Config Source #
Configures VTY using defaults suitable for terminals. This function
can raise VtyConfigurationError
.
runParseConfig :: String -> ByteString -> Config Source #