Go to the documentation of this file.
28 #define G_LOG_DOMAIN "XrmOptions"
105 "Y-offset relative to location",
111 "X-offset relative to location",
117 "Always show number of lines",
124 "Whether to load and show icons",
143 "Ssh command to execute",
149 "Run command to execute",
155 "Command to get extra run targets",
161 "Run command to execute that runs in shell",
167 "Command to executed when -kb-accept-alt binding is hit on selected "
171 "window-match-fields",
174 "Window fields to match in window mode",
180 "Theme to use to look for icons",
187 "Desktop entry fields to match in drun",
193 "Only show Desktop entry from these categories",
199 "Desktop entry show actions.",
202 "drun-display-format",
205 "DRUN format string. (Supports: generic,name,comment,exec,categories)",
211 "Command to open a Desktop Entry that is a Link.",
218 "Disable history in run/ssh",
224 "Programs ignored for history",
236 "Choose the strategy used for sorting: normal (levenshtein) or fzf.",
242 "Set case-sensitivity",
248 "Cycle through the results list",
254 "Enable sidebar-mode",
260 "Enable hover-select",
266 "Row height (in chars)",
272 "Enable auto select mode",
278 "Parse hosts file for ssh mode",
284 "Parse known_hosts file for ssh mode",
290 "Set the modi to combine in combi mode",
296 "Set the matching algorithm. (normal, regex, glob, fuzzy, prefix)",
302 "Tokenize input string",
310 "Monitor id to show on",
323 "Threads to use for string matching",
329 "Scrolling method. (0: Page, 1: Centered)",
335 "Window Format. w (desktop name), t (title), n (name), r (role), c "
342 "Click outside the window to exit",
348 "New style theme file",
354 "Max history size (WARNING: can cause slowdowns when set too high).",
357 "combi-hide-mode-prefix",
360 "Hide the prefix mode prefix on the combi view.",
363 "matching-negate-char",
366 "Set the character used to negate the matching. ('\\0' to disable)",
372 "Directory where history and temporary files are stored.",
378 "Show window thumbnail (if available) as icon in window switcher.",
381 "drun-use-desktop-cache",
384 "DRUN: build and use a cache with desktop file content.",
387 "drun-reload-desktop-cache",
390 "DRUN: If enabled, reload the cache with desktop file content.",
396 "Normalize string when matching (disables match highlighting).",
402 "Steal focus on launch and restore to window that had it on rofi start on "
406 "application-fallback-icon",
409 "Fallback icon to use when the application icon is not found in run/drun.",
425 const char *comment) {
444 iter = g_list_next(iter)) {
445 if (g_strcmp0(((
Property *)(iter->data))->name, key) == 0) {
447 g_debug(
"Setting property from backup list: %s", key);
449 (
Property *)(iter->data), &error)) {
450 g_debug(
"Failed to set property on custom entry: %s", key);
465 char *key = g_strdup_printf(
"-%s", option->
name);
466 switch (option->
type) {
479 if (option->
mem != NULL) {
492 key = g_strdup_printf(
"-no-%s", option->
name);
527 char **tokens = g_strsplit(
stored_argv[in],
"-", 3);
529 for (
int j = 1; tokens && tokens[j]; j++) {
532 if (
count > 2 && g_strcmp0(tokens[1],
"no") != 0) {
533 GString *str = g_string_new(
"configuration { ");
534 for (
int j = 1; j < (
count - 1); j++) {
535 g_string_append_printf(str,
"%s { ", tokens[j]);
537 g_string_append_printf(str,
"%s: %s;", tokens[
count - 1],
539 for (
int j = 0; j < (
count - 1); j++) {
540 g_string_append(str,
" } ");
545 g_string_assign(str,
"configuration { ");
546 for (
int j = 1; j < (
count - 1); j++) {
547 g_string_append_printf(str,
"%s { ", tokens[j]);
549 char *esc = g_strescape(
stored_argv[in + 1], NULL);
550 g_string_append_printf(str,
"%s: \"%s\";", tokens[
count - 1], esc);
552 for (
int j = 0; j < (
count - 1); j++) {
553 g_string_append(str,
" } ");
559 g_string_free(str, TRUE);
572 g_strdup_printf(
"Option: %s needs to be set with a string not a %s.",
578 for (GList *iter = p->
value.
list; iter != NULL;
579 iter = g_list_next(iter)) {
581 value = g_strdup((
char *)(iter->data));
583 char *nv = g_strjoin(
",", value, (
char *)(iter->data), NULL);
589 value = g_strdup(p->
value.
s);
591 if ((option)->mem != NULL) {
598 (option)->mem = *(option->
value.
str);
603 g_strdup_printf(
"Option: %s needs to be set with a number not a %s.",
612 g_strdup_printf(
"Option: %s needs to be set with a number not a %s.",
621 g_strdup_printf(
"Option: %s needs to be set with a boolean not a %s.",
629 *error = g_strdup_printf(
630 "Option: %s needs to be set with a character not a %s.", option->
name,
638 *error = g_strdup_printf(
"Option: %s is not of a supported type: %s.",
648 if (g_strcmp0(op->
name, p->
name) == 0) {
654 if (g_strcmp0(op->
name, p->
name) == 0) {
658 *error = g_strdup_printf(
"Option: %s is not found.", p->
name);
661 iter = g_list_next(iter)) {
662 if (g_strcmp0(((
Property *)(iter->data))->name, p->
name) == 0) {
668 g_debug(
"Adding option: %s to backup list.", p->
name);
700 fprintf(out,
"\t%s: ", option->
name);
701 switch (option->
type) {
703 fprintf(out,
"%u", *(option->
value.
num));
706 fprintf(out,
"%i", *(option->
value.
snum));
709 if ((*(option->
value.
str)) != NULL) {
711 fprintf(out,
"\"%s\"", *(option->
value.
str));
715 fprintf(out,
"%s", (*(option->
value.
num) == TRUE) ?
"true" :
"false");
722 fprintf(out,
"'\\x%02X'", *(option->
value.
charc));
724 fprintf(out,
" /* unsupported */");
738 fprintf(out,
"configuration {\n");
741 for (
unsigned int i = 0; i < entries; ++i) {
743 if ((i + 1) < entries) {
767 int l = strlen(xo->
name);
776 printf(
"\t-%s [string]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
783 int l = strlen(xo->
name);
791 printf(
"\t-%s [number]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
797 int l = strlen(xo->
name);
805 printf(
"\t-%s [number]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
811 int l = strlen(xo->
name);
819 printf(
"\t-%s [character]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
825 int l = strlen(xo->
name);
834 printf(
"\t-[no-]%s %-*c%s\n", xo->
name, 33 - l,
' ', xo->
comment);
835 printf(
"\t\t%s", (*(xo->
value.
snum)) ?
"True" :
"False");
863 int is_term = isatty(fileno(stdout));
865 for (
unsigned int i = 0; i < entries; ++i) {
866 if ((i + 1) < entries) {
879 const char *def,
int isatty) {
880 int l = 37 - strlen(option) - strlen(type);
888 printf(
"\t%s %s %-*c%s\n", option, type, l,
' ', text);
890 printf(
"\t\t%s\n", def);
898 switch (option->
type) {
900 return g_markup_printf_escaped(
901 "<b%-*s</b> (%u) <span style='italic' size='small'>%s</span>", ll,
904 return g_markup_printf_escaped(
905 "<b%-*s</b> (%d) <span style='italic' size='small'>%s</span>", ll,
908 return g_markup_printf_escaped(
909 "<b>%-*s</b> (%s) <span style='italic' size='small'>%s</span>", ll,
914 return g_markup_printf_escaped(
915 "<b>%-*s</b> (%s) <span style='italic' size='small'>%s</span>", ll,
916 option->
name, (*(option->
value.
num) == TRUE) ?
"true" :
"false",
920 return g_markup_printf_escaped(
921 "<b>%-*s</b> (%c) <span style='italic' size='small'>%s</span>", ll,
924 return g_markup_printf_escaped(
925 "<b%-*s</b> (\\x%02X) <span style='italic' size='small'>%s</span>",
932 return g_strdup(
"failed");
941 size_t max_length = 0;
942 for (
unsigned int i = 0; i < entries; ++i) {
944 max_length = MAX(max_length, l);
948 max_length = MAX(max_length, l);
953 for (
unsigned int i = 0; i < entries; ++i) {
954 if ((i + 1) < entries) {
959 if (strncmp(
xrmOptions[i].name,
"kb", 2) != 0 &&
965 retv = g_realloc(retv, ((*length) + 2) *
sizeof(
char *));
977 retv = g_realloc(retv, ((*length) + 2) *
sizeof(
char *));
983 retv[(*length)] = NULL;
const char *const ConfigSourceStr[]
void config_parse_dump_config_rasi_format(FILE *out, gboolean changes)
Dump configuration in rasi format.
gboolean drun_reload_desktop_cache
static void config_parse_cmd_option(XrmOption *option)
static gboolean __config_parser_set_property(XrmOption *option, const Property *p, char **error)
unsigned int disable_history
static void print_option_boolean(XrmOption *xo, int is_term)
void rofi_theme_property_free(Property *p)
void print_help_msg(const char *option, const char *type, const char *text, const char *def, int isatty)
int find_arg_int(const char *const key, int *val)
static void print_option_snumber(XrmOption *xo, int is_term)
ThemeWidget * rofi_configuration
unsigned int max_history_size
int find_arg(const char *const key)
const char *const PropertyTypeName[P_NUM_TYPES]
static void print_option(XrmOption *xo, int is_term)
gboolean config_parse_set_property(const Property *p, char **error)
Set config option.
unsigned int sidebar_mode
char * drun_display_format
static char * config_parser_return_display_help_entry(XrmOption *option, size_t l)
int find_arg_uint(const char *const key, unsigned int *val)
Property * rofi_theme_property_copy(const Property *p)
char * application_fallback_icon
char matching_negate_char
GList * extra_parsed_options
char ** config_parser_return_display_help(unsigned int *length)
static void config_parse_dump_config_option(FILE *out, XrmOption *option)
gboolean rofi_theme_parse_string(const char *string)
static void print_option_char(XrmOption *xo, int is_term)
unsigned int fixed_num_lines
void config_xresource_free(void)
void rofi_clear_error_messages(void)
void rofi_theme_print_index(ThemeWidget *widget, int index)
char * window_match_fields
void config_parse_cmd_options(void)
void config_parser_add_option(XrmOptionType type, const char *key, void **value, const char *comment)
gboolean window_thumbnail
int find_arg_str(const char *const key, char **val)
int find_arg_char(const char *const key, char *val)
unsigned int parse_known_hosts
gboolean combi_hide_mode_prefix
gboolean drun_use_desktop_cache
XrmOption * extra_options
unsigned int case_sensitive
unsigned int scroll_method
unsigned int num_extra_options
static void print_option_number(XrmOption *xo, int is_term)
unsigned int drun_show_actions
static void print_option_string(XrmOption *xo, int is_term)
union XrmOption::@5 value
static XrmOption xrmOptions[]