Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
setting Struct Reference

Data Fields

char * name
 A string with the setting key as found in the config file.
 
char * section
 A string with the ini section where the variable is allowed.
 
char * description
 A string with a short description of the config variable.
 
enum setting_type type
 Enum of the setting type.
 
char * default_value
 A string with the default value of the setting.
 
void * value
 (nullable) A pointer to the corresponding setting in the setting struct.
 
int(* parser )(const void *data, const char *cfg_value, void *ret)
 (nullable) Function pointer for the parser - to be used in case of enums or other special settings.
 
const void * parser_data
 (nullable) A pointer to the data required for the parser to parse this setting.
 
size_t rule_offset
 The offset of this setting in the rule struct, if it exists.
 
bool different_default
 True if a setting has a different default in the default dunstrc.
 

Detailed Description

Definition at line 26 of file settings_data.h.

Field Documentation

◆ default_value

char* default_value

A string with the default value of the setting.

This should be the same as what it would be in the config file, as this is parsed by the same parser. default_value is unused when the setting is only a rule (value == NULL).

Example: .default_value = "10s", // 10 seconds of time

Definition at line 65 of file settings_data.h.

◆ description

char* description

A string with a short description of the config variable.

This is currently not used, but it may be used to generate help messages.

Definition at line 45 of file settings_data.h.

◆ different_default

bool different_default

True if a setting has a different default in the default dunstrc.

This is useful to transition a default value without breaking exisitng configs. This value is needed for the test suite to skip testing this setting against the default dunstrc.

False by default.

Definition at line 118 of file settings_data.h.

◆ name

char* name

A string with the setting key as found in the config file.

Definition at line 30 of file settings_data.h.

◆ parser

int(* parser) (const void *data, const char *cfg_value, void *ret)

(nullable) Function pointer for the parser - to be used in case of enums or other special settings.

If the parse requires extra data, it should be given with parser_data. This allows for one generic parser for, for example, enums, instead of a parser for every enum.

Parameters
dataThe required data for parsing the value. See parser_data.
cfg_valueThe string representing the value of the config variable
retA pointer to the return value. This casted by the parser to the right type.

Definition at line 93 of file settings_data.h.

◆ parser_data

const void* parser_data

(nullable) A pointer to the data required for the parser to parse this setting.

Definition at line 99 of file settings_data.h.

◆ rule_offset

size_t rule_offset

The offset of this setting in the rule struct, if it exists.

Zero is being interpreted as if no rule exists for this setting.

Example: .rule_offset = offsetof(struct rule, member);

Definition at line 108 of file settings_data.h.

◆ section

char* section

A string with the ini section where the variable is allowed.

This section should be part of the special_sections array.

Example: .section = "global",

Definition at line 39 of file settings_data.h.

◆ type

enum setting_type type

Enum of the setting type.

Every setting type is parsed differently in option_parser.c.

Definition at line 54 of file settings_data.h.

◆ value

void* value

(nullable) A pointer to the corresponding setting in the setting struct.

Make sure to always take the address, even if it's already a pointer in the settings struct. If value is NULL, the setting is interpreted as a rule.

Example: .value = &settings.font,

Definition at line 77 of file settings_data.h.


The documentation for this struct was generated from the following file: