2017-04-15 06:32:05 -04:00
|
|
|
/*
|
|
|
|
* rofi
|
|
|
|
*
|
|
|
|
* MIT/X11 License
|
2021-06-09 08:50:39 -04:00
|
|
|
* Copyright © 2013-2021 Qball Cow <qball@gmpclient.org>
|
2017-04-15 06:32:05 -04:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-07-27 04:17:12 -04:00
|
|
|
#ifndef ROFI_XRMOPTIONS_H
|
|
|
|
#define ROFI_XRMOPTIONS_H
|
2017-03-28 11:33:43 -04:00
|
|
|
#include "theme.h"
|
2021-08-19 07:34:01 -04: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
|
|
|
|
*
|
2021-08-19 07:34:01 -04:00
|
|
|
* Configuration described in Xresource format. This can be loaded from the X
|
|
|
|
* server or file.
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
|
|
|
* @defgroup CONFXServer XServer Configuration
|
|
|
|
* @ingroup CONFXResources
|
|
|
|
*
|
2021-08-19 07:34:01 -04:00
|
|
|
* Loads the configuration directly from the X server using the XResources
|
|
|
|
* system.
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
|
|
|
* @defgroup CONFCommandline Commandline Configuration
|
|
|
|
* @ingroup CONFIGURATION
|
|
|
|
*
|
|
|
|
* Modified the configuration based on commandline arguments
|
|
|
|
*
|
|
|
|
* @defgroup CONFFile File Configuration
|
|
|
|
* @ingroup CONFXResources
|
|
|
|
*
|
2021-08-19 07:34:01 -04:00
|
|
|
* Loads the configuration from a config file that uses the XResource file
|
|
|
|
* format.
|
2016-01-07 07:32:33 -05:00
|
|
|
*
|
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
|
|
|
*/
|
2021-08-19 07:34:01 -04:00
|
|
|
typedef enum {
|
|
|
|
/** Config option is string */
|
|
|
|
xrm_String = 0,
|
|
|
|
/** Config option is an unsigned number */
|
|
|
|
xrm_Number = 1,
|
|
|
|
/** Config option is a signed number */
|
|
|
|
xrm_SNumber = 2,
|
|
|
|
/** Config option is a boolean (true/false) value*/
|
|
|
|
xrm_Boolean = 3,
|
|
|
|
/** Config option is a character */
|
|
|
|
xrm_Char = 4
|
2015-02-15 15:15:16 -05:00
|
|
|
} XrmOptionType;
|
|
|
|
|
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
|
|
|
*/
|
2021-08-19 07:34:01 -04:00
|
|
|
void config_parse_cmd_options(void);
|
2016-01-07 07:32:33 -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
|
|
|
*/
|
2021-08-19 07:34:01 -04:00
|
|
|
void config_xresource_free(void);
|
2014-05-22 15:56:57 -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
|
2017-11-23 12:41:52 -05:00
|
|
|
* @param key The key referring to this configuration option
|
2016-01-07 07:32:33 -05:00
|
|
|
* @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
|
|
|
*/
|
2021-08-19 07:34: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
|
|
|
|
|
|
|
/**
|
2021-08-19 07:34:01 -04:00
|
|
|
* Print the current configuration to stdout. Uses bold/italic when printing to
|
|
|
|
* terminal.
|
2016-01-07 07:32:33 -05:00
|
|
|
*/
|
2021-08-19 07:34:01 -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.
|
|
|
|
*/
|
2021-08-19 07:34:01 -04: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
|
|
|
|
*/
|
2021-08-19 07:34:01 -04:00
|
|
|
char **config_parser_return_display_help(unsigned int *length);
|
2016-05-30 04:25:58 -04:00
|
|
|
|
2017-03-27 03:04:55 -04:00
|
|
|
/**
|
|
|
|
* @brief Set config option.
|
|
|
|
*
|
|
|
|
* Sets both the static as dynamic config option.
|
|
|
|
*
|
2017-03-28 11:33:43 -04:00
|
|
|
* @param p Property to set
|
2017-06-20 12:10:18 -04:00
|
|
|
* @param error Error msg when not found.
|
|
|
|
*
|
|
|
|
* @returns true when failed to set property.
|
2017-03-27 03:04:55 -04:00
|
|
|
*/
|
2021-08-19 07:34:01 -04:00
|
|
|
gboolean config_parse_set_property(const Property *p, char **error);
|
2017-06-21 02:19:47 -04:00
|
|
|
|
|
|
|
/**
|
2020-01-02 06:00:44 -05:00
|
|
|
* @param out The destination.
|
2017-09-04 10:46:06 -04:00
|
|
|
* @param changes Only print the changed options.
|
|
|
|
*
|
2017-06-21 02:19:47 -04:00
|
|
|
* @brief Dump configuration in rasi format.
|
|
|
|
*/
|
2021-08-19 07:34:01 -04:00
|
|
|
void config_parse_dump_config_rasi_format(FILE *out, gboolean changes);
|
2020-10-12 15:39:36 -04:00
|
|
|
/** @}*/
|
2014-02-02 04:54:01 -05:00
|
|
|
#endif
|