2015-07-27 08:17:12 +00:00
|
|
|
#ifndef ROFI_XRMOPTIONS_H
|
|
|
|
#define ROFI_XRMOPTIONS_H
|
2016-01-07 12:32:33 +00:00
|
|
|
// Big thanks to Sean Pringle for this code.
|
2014-05-22 19:56:57 +00:00
|
|
|
|
2016-01-07 07:54:24 +00:00
|
|
|
/**
|
2016-01-07 12:32:33 +00:00
|
|
|
* @defgroup CONFXResources XResources Configuration
|
|
|
|
* @ingroup CONFIGURATION
|
|
|
|
*
|
|
|
|
* Configuration described in Xresource format. This can be loaded from the X server or file.
|
|
|
|
*
|
|
|
|
* @defgroup CONFXServer XServer Configuration
|
|
|
|
* @ingroup CONFXResources
|
|
|
|
*
|
|
|
|
* Loads the configuration directly from the X server using the XResources system.
|
|
|
|
*
|
|
|
|
* @defgroup CONFCommandline Commandline Configuration
|
|
|
|
* @ingroup CONFIGURATION
|
|
|
|
*
|
|
|
|
* Modified the configuration based on commandline arguments
|
|
|
|
*
|
|
|
|
* @defgroup CONFFile File Configuration
|
|
|
|
* @ingroup CONFXResources
|
|
|
|
*
|
|
|
|
* Loads the configuration from a config file that uses the XResource file format.
|
|
|
|
*
|
2016-01-07 07:54:24 +00:00
|
|
|
* @defgroup CONFIGURATION Configuration
|
|
|
|
*
|
|
|
|
* This provides rofi configuration system, supports:
|
|
|
|
* * Compiled defaults.
|
|
|
|
* * XResource parsing
|
|
|
|
* * Config file parsing
|
|
|
|
* * Commandline options.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2015-02-15 20:15:16 +00:00
|
|
|
// This maps xresource options to config structure.
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
xrm_String = 0,
|
|
|
|
xrm_Number = 1,
|
|
|
|
xrm_SNumber = 2,
|
2015-02-17 09:31:59 +00:00
|
|
|
xrm_Boolean = 3,
|
|
|
|
xrm_Char = 4
|
2015-02-15 20:15:16 +00:00
|
|
|
} XrmOptionType;
|
|
|
|
|
2014-05-27 06:31:59 +00:00
|
|
|
/**
|
|
|
|
* @param display Handler of the display to fetch the settings from.
|
|
|
|
*
|
|
|
|
* Parse the rofi related X resource options of the
|
|
|
|
* connected X server.
|
2016-01-07 12:32:33 +00:00
|
|
|
*
|
|
|
|
* @ingroup CONFXServer
|
2014-05-27 06:31:59 +00:00
|
|
|
*/
|
2016-02-28 00:08:12 +00:00
|
|
|
void config_parse_xresource_options ( xcb_connection_t *xcb_connection, xcb_screen_t *xcb_screen );
|
2016-01-07 12:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup CONFFile
|
|
|
|
*/
|
2016-01-03 12:30:43 +00:00
|
|
|
void config_parse_xresource_options_file ( const char *filename );
|
2014-02-02 09:54:01 +00:00
|
|
|
|
2015-02-17 09:31:59 +00:00
|
|
|
/**
|
|
|
|
* Parse commandline options.
|
2016-01-07 12:32:33 +00:00
|
|
|
* @ingroup CONFCommandline
|
2015-02-17 09:31:59 +00:00
|
|
|
*/
|
2015-03-11 17:32:37 +00:00
|
|
|
void config_parse_cmd_options ( void );
|
2016-01-07 12:32:33 +00:00
|
|
|
|
2015-02-17 09:31:59 +00:00
|
|
|
/**
|
|
|
|
* Parse dynamic commandline options.
|
2016-01-07 12:32:33 +00:00
|
|
|
* @ingroup CONFCommandline
|
2015-02-17 09:31:59 +00:00
|
|
|
*/
|
2015-03-11 17:32:37 +00:00
|
|
|
void config_parse_cmd_options_dynamic ( void );
|
2016-01-07 12:32:33 +00:00
|
|
|
|
2015-02-15 20:15:16 +00:00
|
|
|
/**
|
|
|
|
* @param display Handler of the display to fetch the settings from.
|
|
|
|
*
|
|
|
|
* Parse the rofi related X resource options of the
|
|
|
|
* connected X server.
|
2016-01-07 12:32:33 +00:00
|
|
|
*
|
|
|
|
* @ingroup CONFXServer
|
2015-02-15 20:15:16 +00:00
|
|
|
*/
|
2016-02-28 00:08:12 +00:00
|
|
|
void config_parse_xresource_options_dynamic ( xcb_connection_t *xcb_connection, xcb_screen_t *xcb_screen );
|
2016-01-07 12:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup CONFFile
|
|
|
|
*/
|
2016-01-03 12:30:43 +00:00
|
|
|
void config_parse_xresource_options_dynamic_file ( const char *filename );
|
2015-02-15 20:15:16 +00:00
|
|
|
|
2016-01-04 06:59:30 +00:00
|
|
|
/**
|
|
|
|
* Initializes the Xresourced system.
|
2016-01-07 12:32:33 +00:00
|
|
|
*
|
|
|
|
* @ingroup CONFXResources
|
2016-01-04 06:59:30 +00:00
|
|
|
*/
|
|
|
|
void config_parse_xresource_init ( void );
|
2014-05-27 06:31:59 +00:00
|
|
|
/**
|
|
|
|
* Free any allocated memory.
|
2016-01-07 12:32:33 +00:00
|
|
|
*
|
|
|
|
* @ingroup CONFXResources
|
2014-05-27 06:31:59 +00:00
|
|
|
*/
|
2015-02-03 07:21:59 +00:00
|
|
|
void config_xresource_free ( void );
|
2014-05-22 19:56:57 +00:00
|
|
|
|
2014-05-27 06:31:59 +00:00
|
|
|
/**
|
|
|
|
* Dump the settings in a Xresources compatible way to
|
|
|
|
* stdout.
|
2016-01-07 12:32:33 +00:00
|
|
|
*
|
|
|
|
* @ingroup CONFXResources
|
|
|
|
*/
|
|
|
|
void config_parse_xresource_dump ( void );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dump the theme related settings in Xresources compatible way to
|
|
|
|
* stdout.
|
|
|
|
*
|
|
|
|
* @ingroup CONFXResources
|
2014-05-27 06:31:59 +00:00
|
|
|
*/
|
2016-01-07 12:32:33 +00:00
|
|
|
void config_parse_xresources_theme_dump ( void );
|
2014-05-27 06:31:59 +00:00
|
|
|
|
2015-02-17 09:31:59 +00:00
|
|
|
/**
|
2016-01-07 12:32:33 +00:00
|
|
|
* @param type The type of the value
|
|
|
|
* @param key The key refering to this configuration option
|
|
|
|
* @param value The value to update based [out][in]
|
|
|
|
* @param command Description of this configuration option
|
|
|
|
*
|
|
|
|
* Add option (at runtime) to the dynamic option parser.
|
2015-02-17 09:31:59 +00:00
|
|
|
*/
|
2015-10-16 06:42:01 +00:00
|
|
|
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
|
2016-01-07 12:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Print the current configuration to stdout. Uses bold/italic when printing to terminal.
|
|
|
|
*/
|
2015-10-15 20:33:44 +00:00
|
|
|
void print_options ( void );
|
2016-01-07 12:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param option The name of the option
|
|
|
|
* @param type String describing the type
|
|
|
|
* @param text Description of the option
|
|
|
|
* @param def Current value of the option
|
|
|
|
* @param isatty If printed to a terminal
|
|
|
|
*
|
|
|
|
* Function that does the markup for printing an configuration option to stdout.
|
|
|
|
*/
|
2015-11-14 18:59:56 +00:00
|
|
|
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
|
2016-01-07 07:54:24 +00:00
|
|
|
|
|
|
|
/* @}*/
|
2014-02-02 09:54:01 +00:00
|
|
|
#endif
|