Module settings
Centralized settings system
The settings
module provides a central place to access and modify settings
for all of luakit's modules.
Functions
settings.register_settings (settings)
Register a table of settings. Entries in the table of settings to register should be keyed by the setting path string.
Parameters
-
settingsType: {[string]=table}The table of settings to register.
Parameter table format
Each value elements of the
settings
argument is in the following format:{ type, default }
type
: string, the type of the setting value. When a container, useconatiner_name:inner_type
(the colon is the important part). Example for an array of strings:"array:string"
default
:type
, the default setting value when it isn't set manually
settings.get_setting_for_view (view, key)
Retrieve the value of a setting for a webview.
This function considers, in order:
- any view-specific overrides
- the setting's domain-specific values
- the setting's non-domain-specific value
- the setting's default value
The settings key must be a valid settings key.
Parameters
-
viewType: widgetThe webview.
-
keyType: stringThe key of the setting to retrieve.
Return Values
-
any typeThe value of the setting.
settings.override_setting_for_view (view, key)
Add or remove a view-specific override for a setting.
Passing nil
as the value
will clear any override.
The settings key must be a valid settings key.
Parameters
-
viewType: widgetThe webview.
-
keyType: stringThe key of the setting to override.
Return Values
-
any typeThe new value of the setting override.
settings.override_setting (key, The)
Add an override for a setting.
The settings key must be a valid settings key.
Parameters
-
keyType: stringThe key of the setting to override.
-
TheType: any typevalue of the setting override.
settings.get_setting (key)
Retrieve the value of a setting, whether it's explicitly set or the default.
This does not take into account any domain-specific values.
The settings key must be a valid settings key.
Parameters
-
keyType: stringThe key of the setting to retrieve.
Return Values
-
any typeThe value of the setting.
settings.set_setting (key, value, opts)
Assign a value to a setting. Values assigned in this way are persisted to disk, and automatically set when luakit starts.
The settings key must be a valid settings key.
Parameters
-
keyType: stringThe key of the setting to retrieve.
-
valueType: any typeThe new value of the setting.
-
optsType: tableTable of options. Currently the only valid field is
domain
, which allows setting a domain-specific setting value.
settings.get_settings ()
Retrieve information about all registered settings and their values.
Return Values
-
tableA table of records, one for each setting.
settings.add_migration_warning ()
Migration helper function.
settings.migrate_global ()
Migration helper function.
Attribution
Copyright
- 2017 Aidan Holm