2015-07-27 04:17:12 -04:00
|
|
|
#ifndef ROFI_XRMOPTIONS_H
|
|
|
|
#define ROFI_XRMOPTIONS_H
|
2016-03-01 12:11:55 -05:00
|
|
|
#include "xcb.h"
|
2016-01-07 07:32:33 -05:00
|
|
|
// Big thanks to Sean Pringle for this code.
|
2014-05-22 15:56:57 -04:00
|
|
|
|
2016-01-07 02:54:24 -05:00
|
|
|
/**
|
2016-01-07 07:32:33 -05: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 02:54:24 -05:00
|
|
|
* @defgroup CONFIGURATION Configuration
|
|
|
|
*
|
|
|
|
* This provides rofi configuration system, supports:
|
|
|
|
* * Compiled defaults.
|
|
|
|
* * XResource parsing
|
|
|
|
* * Config file parsing
|
|
|
|
* * Commandline options.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/**
|
2016-10-14 10:46:54 -04:00
|
|
|
* Type of the config options.
|
2016-10-14 02:47:21 -04:00
|
|
|
*/
|
2015-02-15 15:15:16 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Config option is string */
|
2015-02-15 15:15:16 -05:00
|
|
|
xrm_String = 0,
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Config option is an unsigned number */
|
2015-02-15 15:15:16 -05:00
|
|
|
xrm_Number = 1,
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Config option is a signed number */
|
2015-02-15 15:15:16 -05:00
|
|
|
xrm_SNumber = 2,
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Config option is a boolean (true/false) value*/
|
2015-02-17 04:31:59 -05:00
|
|
|
xrm_Boolean = 3,
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Config option is a character */
|
2015-02-17 04:31:59 -05:00
|
|
|
xrm_Char = 4
|
2015-02-15 15:15:16 -05:00
|
|
|
} XrmOptionType;
|
|
|
|
|
2014-05-27 02:31:59 -04:00
|
|
|
/**
|
2016-07-29 02:32:34 -04:00
|
|
|
* @param xcb Handler object holding connection used to fetch the settings from.
|
2014-05-27 02:31:59 -04:00
|
|
|
*
|
|
|
|
* Parse the rofi related X resource options of the
|
|
|
|
* connected X server.
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
|
|
|
* @ingroup CONFXServer
|
2014-05-27 02:31:59 -04:00
|
|
|
*/
|
2016-03-01 12:11:55 -05:00
|
|
|
void config_parse_xresource_options ( xcb_stuff *xcb );
|
2016-01-07 07:32:33 -05:00
|
|
|
|
|
|
|
/**
|
2016-10-15 09:39:08 -04:00
|
|
|
* @param filename The xresources file to parse
|
|
|
|
*
|
|
|
|
* Parses filename and updates the config
|
2016-01-07 07:32:33 -05:00
|
|
|
* @ingroup CONFFile
|
|
|
|
*/
|
2016-01-03 07:30:43 -05:00
|
|
|
void config_parse_xresource_options_file ( const char *filename );
|
2014-02-02 04:54:01 -05:00
|
|
|
|
2015-02-17 04:31:59 -05:00
|
|
|
/**
|
|
|
|
* Parse commandline options.
|
2016-01-07 07:32:33 -05:00
|
|
|
* @ingroup CONFCommandline
|
2015-02-17 04:31:59 -05:00
|
|
|
*/
|
2015-03-11 13:32:37 -04:00
|
|
|
void config_parse_cmd_options ( void );
|
2016-01-07 07:32:33 -05:00
|
|
|
|
2015-02-17 04:31:59 -05:00
|
|
|
/**
|
|
|
|
* Parse dynamic commandline options.
|
2016-01-07 07:32:33 -05:00
|
|
|
* @ingroup CONFCommandline
|
2015-02-17 04:31:59 -05:00
|
|
|
*/
|
2015-03-11 13:32:37 -04:00
|
|
|
void config_parse_cmd_options_dynamic ( void );
|
2016-01-07 07:32:33 -05:00
|
|
|
|
2015-02-15 15:15:16 -05:00
|
|
|
/**
|
2016-07-29 02:32:34 -04:00
|
|
|
* @param xcb Handler object that holds connection to X11 server to fetch the settings from.
|
2015-02-15 15:15:16 -05:00
|
|
|
*
|
|
|
|
* Parse the rofi related X resource options of the
|
|
|
|
* connected X server.
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
|
|
|
* @ingroup CONFXServer
|
2015-02-15 15:15:16 -05:00
|
|
|
*/
|
2016-03-01 12:11:55 -05:00
|
|
|
void config_parse_xresource_options_dynamic ( xcb_stuff *xcb );
|
2016-01-07 07:32:33 -05:00
|
|
|
|
|
|
|
/**
|
2016-10-15 09:39:08 -04:00
|
|
|
* @param filename The xresources file to parse
|
|
|
|
*
|
|
|
|
* Parses filename and updates the config. For dynamic options.
|
2016-01-07 07:32:33 -05:00
|
|
|
* @ingroup CONFFile
|
|
|
|
*/
|
2016-01-03 07:30:43 -05:00
|
|
|
void config_parse_xresource_options_dynamic_file ( const char *filename );
|
2015-02-15 15:15:16 -05:00
|
|
|
|
2014-05-27 02:31:59 -04:00
|
|
|
/**
|
|
|
|
* Free any allocated memory.
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
|
|
|
* @ingroup CONFXResources
|
2014-05-27 02:31:59 -04:00
|
|
|
*/
|
2015-02-03 02:21:59 -05:00
|
|
|
void config_xresource_free ( void );
|
2014-05-22 15:56:57 -04:00
|
|
|
|
2014-05-27 02:31:59 -04:00
|
|
|
/**
|
|
|
|
* Dump the settings in a Xresources compatible way to
|
|
|
|
* stdout.
|
2016-01-07 07:32:33 -05: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 02:31:59 -04:00
|
|
|
*/
|
2016-01-07 07:32:33 -05:00
|
|
|
void config_parse_xresources_theme_dump ( void );
|
2014-05-27 02:31:59 -04:00
|
|
|
|
2015-02-17 04:31:59 -05:00
|
|
|
/**
|
2016-01-07 07:32:33 -05: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]
|
2016-07-29 02:32:34 -04:00
|
|
|
* @param comment Description of this configuration option
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
|
|
|
* Add option (at runtime) to the dynamic option parser.
|
2015-02-17 04:31:59 -05:00
|
|
|
*/
|
2015-10-16 02:42:01 -04:00
|
|
|
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
|
2016-01-07 07:32:33 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Print the current configuration to stdout. Uses bold/italic when printing to terminal.
|
|
|
|
*/
|
2015-10-15 16:33:44 -04:00
|
|
|
void print_options ( void );
|
2016-01-07 07:32:33 -05: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 13:59:56 -05:00
|
|
|
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
|
2016-01-07 02:54:24 -05:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/**
|
|
|
|
* @param length the length of the returned array
|
|
|
|
*
|
|
|
|
* Creates an array with a strings describing each keybinding.
|
|
|
|
*
|
|
|
|
* @returns an array of string with length elements
|
|
|
|
*/
|
2016-05-30 04:25:58 -04:00
|
|
|
char ** config_parser_return_display_help ( unsigned int *length );
|
|
|
|
|
2016-01-07 02:54:24 -05:00
|
|
|
/* @}*/
|
2014-02-02 04:54:01 -05:00
|
|
|
#endif
|