rofi  1.7.0
xrmoptions.c File Reference
#include "xrmoptions.h"
#include "helper.h"
#include "rofi-types.h"
#include "rofi.h"
#include "settings.h"
#include "xcb-internal.h"
#include "xcb.h"
#include <ctype.h>
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <xcb/xcb.h>
#include <xcb/xkb.h>
Include dependency graph for xrmoptions.c:

Go to the source code of this file.

Data Structures

struct  XrmOption
 

Macros

#define G_LOG_DOMAIN   "XrmOptions"
 

Enumerations

enum  ConfigSource { CONFIG_DEFAULT = 0 , CONFIG_FILE = 1 , CONFIG_FILE_THEME = 2 , CONFIG_CMDLINE = 3 }
 

Functions

static gboolean __config_parser_set_property (XrmOption *option, const Property *p, char **error)
 
void config_parser_add_option (XrmOptionType type, const char *key, void **value, const char *comment)
 
static void config_parse_cmd_option (XrmOption *option)
 
void config_parse_cmd_options (void)
 
gboolean config_parse_set_property (const Property *p, char **error)
 Set config option. More...
 
void config_xresource_free (void)
 
static void config_parse_dump_config_option (FILE *out, XrmOption *option)
 
void config_parse_dump_config_rasi_format (FILE *out, gboolean changes)
 Dump configuration in rasi format. More...
 
static void print_option_string (XrmOption *xo, int is_term)
 
static void print_option_number (XrmOption *xo, int is_term)
 
static void print_option_snumber (XrmOption *xo, int is_term)
 
static void print_option_char (XrmOption *xo, int is_term)
 
static void print_option_boolean (XrmOption *xo, int is_term)
 
static void print_option (XrmOption *xo, int is_term)
 
void print_options (void)
 
void print_help_msg (const char *option, const char *type, const char *text, const char *def, int isatty)
 
static char * config_parser_return_display_help_entry (XrmOption *option, size_t l)
 
char ** config_parser_return_display_help (unsigned int *length)
 

Variables

ThemeWidgetrofi_configuration = NULL
 
const char *const ConfigSourceStr []
 
static XrmOption xrmOptions []
 
XrmOptionextra_options = NULL
 
unsigned int num_extra_options = 0
 
GList * extra_parsed_options = NULL
 

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "XrmOptions"

Log domain for this module

Definition at line 28 of file xrmoptions.c.

Enumeration Type Documentation

◆ ConfigSource

Enumerator of different sources of configuration.

Enumerator
CONFIG_DEFAULT 
CONFIG_FILE 
CONFIG_FILE_THEME 
CONFIG_CMDLINE 

Definition at line 56 of file xrmoptions.c.

Function Documentation

◆ __config_parser_set_property()

◆ config_parse_cmd_option()

static void config_parse_cmd_option ( XrmOption option)
static

Parse an option from the commandline vector.

Definition at line 463 of file xrmoptions.c.

References XrmOption::charc, CONFIG_CMDLINE, find_arg(), find_arg_char(), find_arg_int(), find_arg_str(), find_arg_uint(), XrmOption::mem, XrmOption::name, XrmOption::num, XrmOption::snum, XrmOption::source, XrmOption::str, XrmOption::type, XrmOption::value, xrm_Boolean, xrm_Char, xrm_Number, xrm_SNumber, and xrm_String.

Referenced by config_parse_cmd_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_parse_dump_config_option()

static void config_parse_dump_config_option ( FILE *  out,
XrmOption option 
)
static

◆ config_parser_return_display_help_entry()

static char* config_parser_return_display_help_entry ( XrmOption option,
size_t  l 
)
static

◆ print_option()

static void print_option ( XrmOption xo,
int  is_term 
)
static

Definition at line 840 of file xrmoptions.c.

References print_option_boolean(), print_option_char(), print_option_number(), print_option_snumber(), print_option_string(), XrmOption::type, xrm_Boolean, xrm_Char, xrm_Number, xrm_SNumber, and xrm_String.

Referenced by print_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_option_boolean()

static void print_option_boolean ( XrmOption xo,
int  is_term 
)
static

Definition at line 824 of file xrmoptions.c.

References color_bold, color_green, color_italic, color_reset, XrmOption::comment, ConfigSourceStr, XrmOption::name, XrmOption::snum, XrmOption::source, and XrmOption::value.

Referenced by print_option().

Here is the caller graph for this function:

◆ print_option_char()

static void print_option_char ( XrmOption xo,
int  is_term 
)
static

Definition at line 810 of file xrmoptions.c.

References XrmOption::charc, color_bold, color_green, color_italic, color_reset, XrmOption::comment, ConfigSourceStr, XrmOption::name, XrmOption::source, and XrmOption::value.

Referenced by print_option().

Here is the caller graph for this function:

◆ print_option_number()

static void print_option_number ( XrmOption xo,
int  is_term 
)
static

Definition at line 782 of file xrmoptions.c.

References color_bold, color_green, color_italic, color_reset, XrmOption::comment, ConfigSourceStr, XrmOption::name, XrmOption::num, XrmOption::source, and XrmOption::value.

Referenced by print_option().

Here is the caller graph for this function:

◆ print_option_snumber()

static void print_option_snumber ( XrmOption xo,
int  is_term 
)
static

Definition at line 796 of file xrmoptions.c.

References color_bold, color_green, color_italic, color_reset, XrmOption::comment, ConfigSourceStr, XrmOption::name, XrmOption::snum, XrmOption::source, and XrmOption::value.

Referenced by print_option().

Here is the caller graph for this function:

◆ print_option_string()

static void print_option_string ( XrmOption xo,
int  is_term 
)
static

Definition at line 766 of file xrmoptions.c.

References color_bold, color_green, color_italic, color_reset, XrmOption::comment, ConfigSourceStr, XrmOption::name, XrmOption::source, XrmOption::str, and XrmOption::value.

Referenced by print_option().

Here is the caller graph for this function:

Variable Documentation

◆ ConfigSourceStr

const char* const ConfigSourceStr[]
Initial value:
= {
"Default",
"File",
"Rasi File",
"Commandline",
}

Different sources of configuration.

Definition at line 49 of file xrmoptions.c.

Referenced by print_option_boolean(), print_option_char(), print_option_number(), print_option_snumber(), and print_option_string().

◆ extra_options

◆ extra_parsed_options

GList* extra_parsed_options = NULL

This is a big hack, we need to fix this.

Definition at line 419 of file xrmoptions.c.

Referenced by config_parse_set_property(), config_parser_add_option(), and config_xresource_free().

◆ num_extra_options

unsigned int num_extra_options = 0

◆ rofi_configuration

ThemeWidget* rofi_configuration = NULL

Used to store config options.

Definition at line 46 of file xrmoptions.c.

Referenced by cleanup(), config_parse_dump_config_rasi_format(), main(), and rofi_config_find_widget().

◆ xrmOptions

XrmOption xrmOptions[]
static

Map X resource and commandline options to internal options Currently supports string, boolean and number (signed and unsigned).

Definition at line 81 of file xrmoptions.c.

Referenced by config_parse_cmd_options(), config_parse_dump_config_rasi_format(), config_parse_set_property(), config_parser_return_display_help(), config_xresource_free(), and print_options().