Expand description

Set configuration defaults, reads and writes Tp-Note’s configuration file and exposes the configuration as static variable.

Structs

Arguments lists for invoking external applications, deserialized from the configuration file.

Command line arguments, deserialized form configuration file.

Reads and parses the configuration file “tp-note.toml”. An alternative filename (optionally with absolute path) can be given on the command line with “–config”.

Variable indicating with Err if the loading of the configuration file went wrong.

This is where the Tp-Note stores its configuration file.

Configuration data, deserialized from the configuration file.

Configuration of clipboard behaviour, deserialized from the configuration file.

Store the extension as key and mime type as value in HashMap.

Configuration data for the viewer feature, deserialized from the configuration file.

Constants

Default command line argument list when launching the web browser. The list is executed item by item until an installed web browser is found. Can be changed in config file.

Default command line argument list when launching external editor. The editor list is executed item by item until an editor is found. Can be changed in config file.

Default command line argument list when launching an external editor and no graphical environment is available (DISPLAY=''). This lists console file editors only. The editor list is executed item by item until an editor is found. Can be changed in config file.

Default value for the command line flag --add-header. If unset, Tp-Note exits of when it tries to open a text file without a YAML header. When this flag is set, the missing header is constructed by means of the text file’s filename and creation date.

Default value for the command line option --debug. Determines the maximum debug level events must have, to be logged. If the command line option --debug is present, its value will be used instead.

Default value for the command line flag --edit to disable file watcher, (Markdown)-renderer, html server and a web browser launcher set to true.

Default value for the command line flag --no-filename-sync to disable the title to filename synchronisation mechanism permanently. If set to true, the corresponding command line flag is ignored.

Default value for the command line flag --popup. If the command line flag --popup or POPUP is true, all log events will also trigger the appearance of a popup alert window. Note, that error level debug events will always pop up, regardless of --popup and POPUP (unless --debug=off).

Default value for the command line flag --tty. Tp-Note tries different heuristics to detect weather a graphic environment is available or not. For example, under Linux, the ‘DISPLAY’ environment variable is evaluated. The ‘--tty’ flag disables the automatic detection and sets Tp-Note in “console” mode, where only the non GUI editor (see configuration variable: ‘[app_args] editor_console’) and no viewer is launched. If this is set to true Tp-Note starts in console mode permanently.

Name of this executable (without the Windows “.exe” extension).

Should the clipboard be emptied when tp-note closes? Default value.

By default clipboard support is enabled, can be disabled in config file. A false value here will set ENABLE_EMPTY_CLIPBOARD to false.

Tp-Note’s configuration file filename.

For security reasons, Tp-Note’s internal viewer only displays a limited number number of Tp-Note files when browsing between files. This variable limits this number.

When set to true, the viewer feature is automatically disabled when Tp-Note encounters an .md file without header. Experienced users can set this to true. This setting is ignored, meaning is considered false, if ARG_DEFAULT_ADD_HEADER=true or ARGS.add_header=true or ARGS.viewer=true.

How often should the file watcher check for changes? Delay in milliseconds. Maximum value is 2000.

Served file types with corresponding mime types. The first entry per line is the file extension in lowercase(!), the second the corresponding mime type. Embedded files with types other than those listed here are silently ignored. Note, that image files must be located in the same or in the note’s parent directory.

When Tp-Note starts, it launches two external applications: some text editor and the viewer (web browser). By default the two programs are launched at the same time (VIEWER_STARTUP_DELAY==0). If VIEWER_STARTUP_DELAY>0 the viewer (web browser) will be launched VIEWER_STARTUP_DELAY milliseconds after the text editor. If VIEWER_STARTUP_DELAY<0 the viewer will be started first. Common values are -1000, 0 and 1000.

The maximum number of TCP connections the HTTP server can handle at the same time. In general, the serving and live update of the HTML rendition of the note file, requires normally 3 TCP connections: 1 old event channel (that is still open from the previous update), 1 TCP connection to serve the HTML, the local images (and referenced documents), and 1 new event channel. In practise, stale connection are not always closed immediately. Hence 4 open connections are not uncommon.

Functions

Parse the configuration file if it exists. Otherwise write one with default values.

Writes the default configuration to Path.