Skip to main content

Module settings

Module settings 

Source
Expand description

What the window remembers between starts: the language, the theme, the unit switches, the speed, and the config or machine file last opened with the machine picked. A small TOML file in the user’s config folder, or where SIM_APP_SETTINGS points. Nothing here reads the environment or the disk of its own accord, so that the tests and the developer hooks can keep clear of the user’s file (path).

Structs§

Settings
The values kept; None where the file has none (a first start), so that the default shows.

Functions§

language
The language to start in: the environment’s SIM_APP_LANG first, then the stored one, then the system’s, then the first of languages; one of them that the app does not have is passed over.
load
The settings stored in path: none where there is no file yet; where it cannot be read, is no TOML or is of another version, none either, and the message that says so.
path
The file the settings are kept in, from the environment env (a lookup by name): SIM_APP_SETTINGS where set; else none while the screenshot hook runs or in a test, which must not read or write the user’s file; else the app’s folder in the user’s config folder (APPDATA on Windows, XDG_CONFIG_HOME or ~/.config elsewhere, ~/Library/Application Support on macOS). None where the environment names no such folder.
save
system_language
The system’s language code from the locale variables (LC_ALL, LC_MESSAGES, LANG; “de_DE.UTF-8” is “de”), where there are any. Windows has none of them: the app stays English there.