28#define G_LOG_DOMAIN "XrmOptions"
50 "Commandline",
"Don't Display"};
102 "Location on screen",
108 "Y-offset relative to location. *DEPRECATED* see rofi-theme manpage for "
115 "X-offset relative to location. *DEPRECATED* see rofi-theme manpage for "
122 "Always show number of lines",
129 "Whether to load and show icons",
148 "Ssh command to execute",
154 "Run command to execute",
160 "Command to get extra run targets",
166 "Run command to execute that runs in shell",
172 "Command to executed when -kb-accept-alt binding is hit on selected "
176 "window-match-fields",
179 "Window fields to match in window mode",
185 "Theme to use to look for icons",
192 "Desktop entry fields to match in drun",
198 "Only show Desktop entry from these categories",
204 "Desktop entry show actions.",
207 "drun-display-format",
210 "DRUN format string. (Supports: generic,name,comment,exec,categories)",
216 "Command to open a Desktop Entry that is a Link.",
223 "Disable history in run/ssh",
229 "Programs ignored for history",
241 "Choose the strategy used for sorting: normal (levenshtein) or fzf.",
247 "Set case-sensitivity",
253 "Cycle through the results list",
259 "Enable sidebar-mode",
265 "Enable hover-select",
271 "Row height (in chars)",
277 "Enable auto select mode",
283 "Parse hosts file for ssh mode",
289 "Parse known_hosts file for ssh mode",
295 "Set the modi to combine in combi mode",
301 "Set the modi to combine in combi mode",
307 "Set the matching algorithm. (normal, regex, glob, fuzzy, prefix)",
313 "Tokenize input string",
321 "Monitor id to show on",
334 "Threads to use for string matching",
340 "Scrolling method. (0: Page, 1: Centered)",
346 "Window Format. w (desktop name), t (title), n (name), r (role), c "
353 "Click outside the window to exit",
359 "New style theme file",
365 "Max history size (WARNING: can cause slowdowns when set too high).",
368 "combi-hide-mode-prefix",
371 "Hide the prefix mode prefix on the combi view.**deprecated** use "
372 "combi-display-format",
375 "combi-display-format",
378 "Combi format string. (Supports: mode, text)",
381 "matching-negate-char",
384 "Set the character used to negate the matching. ('\\0' to disable)",
390 "Directory where history and temporary files are stored.",
396 "Show window thumbnail (if available) as icon in window switcher.",
399 "drun-use-desktop-cache",
402 "DRUN: build and use a cache with desktop file content.",
405 "drun-reload-desktop-cache",
408 "DRUN: If enabled, reload the cache with desktop file content.",
414 "Normalize string when matching (disables match highlighting).",
420 "Steal focus on launch and restore to window that had it on rofi start on "
424 "application-fallback-icon",
427 "Fallback icon to use when the application icon is not found in run/drun.",
430 "refilter-timeout-limit",
433 "When there are more entries then this limit, only refilter after a "
437 "xserver-i300-workaround",
440 "Workaround for XServer issue #300 (issue #611 for rofi.)",
456 const char *comment) {
475 iter = g_list_next(iter)) {
476 if (g_strcmp0(((
Property *)(iter->data))->name, key) == 0) {
478 g_debug(
"Setting property from backup list: %s", key);
480 (
Property *)(iter->data), &error)) {
481 g_debug(
"Failed to set property on custom entry: %s", key);
496 char *key = g_strdup_printf(
"-%s", option->
name);
497 switch (option->
type) {
510 if (option->
mem != NULL) {
523 key = g_strdup_printf(
"-no-%s", option->
name);
542 int count,
char *argv,
544 for (
int j = 0; j < (
count - 1); j++) {
545 g_string_append_printf(str,
"%s { ", tokens[j]);
548 char *esc = g_strescape(argv, NULL);
549 g_string_append_printf(str,
"%s: \"%s\";", tokens[
count - 1], esc);
552 g_string_append_printf(str,
"%s: %s;", tokens[
count - 1], argv);
554 for (
int j = 0; j < (
count - 1); j++) {
555 g_string_append(str,
" } ");
580 char **tokens = g_strsplit(
stored_argv[in],
"-", 3);
582 for (
int j = 1; tokens && tokens[j]; j++) {
586 if (g_str_has_prefix(tokens[1],
"theme")) {
589 count = g_strv_length(tokens);
591 GString *str = g_string_new(
"");
597 g_string_free(str, TRUE);
600 g_string_free(str, TRUE);
602 }
else if (g_strcmp0(tokens[1],
"no") != 0) {
603 GString *str = g_string_new(
"configuration { ");
606 g_string_append(str,
"}");
607 g_debug(
"str: \"%s\"\n", str->str);
611 g_string_assign(str,
"configuration { ");
614 g_string_append(str,
"}");
615 g_debug(
"str: \"%s\"\n", str->str);
621 g_string_free(str, TRUE);
635 g_strdup_printf(
"Option: %s needs to be set with a string not a %s.",
641 for (GList *iter = p->
value.
list; iter != NULL;
642 iter = g_list_next(iter)) {
645 value = g_strdup((
char *)(p2->
value.
s));
647 char *nv = g_strjoin(
",", value, (
char *)(p2->
value.
s), NULL);
653 value = g_strdup_printf(
"%d", p->
value.
i);
655 value = g_strdup(p->
value.
s);
657 if ((option)->mem != NULL) {
664 (option)->mem = *(option->
value.
str);
669 g_strdup_printf(
"Option: %s needs to be set with a number not a %s.",
678 g_strdup_printf(
"Option: %s needs to be set with a number not a %s.",
687 g_strdup_printf(
"Option: %s needs to be set with a boolean not a %s.",
695 *error = g_strdup_printf(
696 "Option: %s needs to be set with a character not a %s.", option->
name,
704 *error = g_strdup_printf(
"Option: %s is not of a supported type: %s.",
712 if (g_ascii_strcasecmp(p->
name,
"theme") == 0) {
714 *error = g_strdup_printf(
"The option:\n<b>\nconfiguration\n{\n\ttheme: "
715 "\"%s\";\n}</b>\nis deprecated. Please replace "
716 "with: <b>@theme \"%s\"</b> "
717 "after the configuration block.",
720 *error = g_strdup_printf(
"The option:\n<b>\nconfiguration\n{\n\ttheme: "
721 "\"%s\";\n}</b>\nis deprecated. Please replace "
722 "with: <b>@theme \"%s\"</b> "
723 "after the configuration block.",
724 "myTheme",
"myTheme");
730 if (g_strcmp0(op->
name, p->
name) == 0) {
736 if (g_strcmp0(op->
name, p->
name) == 0) {
741 g_debug(
"Option: %s is not found.", p->
name);
744 iter = g_list_next(iter)) {
745 if (g_strcmp0(((
Property *)(iter->data))->name, p->
name) == 0) {
751 g_debug(
"Adding option: %s to backup list.", p->
name);
783 fprintf(out,
"\t%s: ", option->
name);
784 switch (option->
type) {
786 fprintf(out,
"%u", *(option->
value.
num));
789 fprintf(out,
"%i", *(option->
value.
snum));
792 if ((*(option->
value.
str)) != NULL) {
794 fprintf(out,
"\"%s\"", *(option->
value.
str));
798 fprintf(out,
"%s", (*(option->
value.
num) == TRUE) ?
"true" :
"false");
805 fprintf(out,
"'\\x%02X'", *(option->
value.
charc));
807 fprintf(out,
" /* unsupported */");
821 fprintf(out,
"configuration {\n");
824 for (
unsigned int i = 0; i < entries; ++i) {
826 if ((i + 1) < entries) {
861 int l = strlen(xo->
name);
870 printf(
"\t-%s [string]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
877 int l = strlen(xo->
name);
885 printf(
"\t-%s [number]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
891 int l = strlen(xo->
name);
899 printf(
"\t-%s [number]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
905 int l = strlen(xo->
name);
913 printf(
"\t-%s [character]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
919 int l = strlen(xo->
name);
928 printf(
"\t-[no-]%s %-*c%s\n", xo->
name, 33 - l,
' ', xo->
comment);
929 printf(
"\t\t%s", (*(xo->
value.
snum)) ?
"True" :
"False");
960 int is_term = isatty(fileno(stdout));
962 for (
unsigned int i = 0; i < entries; ++i) {
963 if ((i + 1) < entries) {
976 const char *def,
int isatty) {
977 int l = 37 - strlen(option) - strlen(type);
985 printf(
"\t%s %s %-*c%s\n", option, type, l,
' ', text);
987 printf(
"\t\t%s\n", def);
995 switch (option->
type) {
997 return g_markup_printf_escaped(
998 "<b%-*s</b> (%u) <span style='italic' size='small'>%s</span>", ll,
1001 return g_markup_printf_escaped(
1002 "<b%-*s</b> (%d) <span style='italic' size='small'>%s</span>", ll,
1005 return g_markup_printf_escaped(
1006 "<b>%-*s</b> (%s) <span style='italic' size='small'>%s</span>", ll,
1011 return g_markup_printf_escaped(
1012 "<b>%-*s</b> (%s) <span style='italic' size='small'>%s</span>", ll,
1013 option->
name, (*(option->
value.
num) == TRUE) ?
"true" :
"false",
1017 return g_markup_printf_escaped(
1018 "<b>%-*s</b> (%c) <span style='italic' size='small'>%s</span>", ll,
1021 return g_markup_printf_escaped(
1022 "<b%-*s</b> (\\x%02X) <span style='italic' size='small'>%s</span>",
1029 return g_strdup(
"failed");
1038 size_t max_length = 0;
1039 for (
unsigned int i = 0; i < entries; ++i) {
1041 max_length = MAX(max_length, l);
1045 max_length = MAX(max_length, l);
1050 for (
unsigned int i = 0; i < entries; ++i) {
1051 if ((i + 1) < entries) {
1056 if (strncmp(
xrmOptions[i].name,
"kb", 2) != 0 &&
1062 retv = g_realloc(retv, ((*length) + 2) *
sizeof(
char *));
1074 retv = g_realloc(retv, ((*length) + 2) *
sizeof(
char *));
1079 if ((*length) > 0) {
1080 retv[(*length)] = NULL;
void config_parse_cmd_options(void)
void config_parser_add_option(XrmOptionType type, const char *key, void **value, const char *comment)
void print_help_msg(const char *option, const char *type, const char *text, const char *def, int isatty)
gboolean config_parse_set_property(const Property *p, char **error)
Set config option.
void config_parse_dump_config_rasi_format(FILE *out, gboolean changes)
Dump configuration in rasi format.
char ** config_parser_return_display_help(unsigned int *length)
void config_xresource_free(void)
int find_arg_char(const char *const key, char *val)
int find_arg_int(const char *const key, int *val)
int find_arg_str(const char *const key, char **val)
int find_arg_uint(const char *const key, unsigned int *val)
int find_arg(const char *const key)
void rofi_clear_error_messages(void)
const char *const PropertyTypeName[P_NUM_TYPES]
unsigned int disable_history
char * application_fallback_icon
unsigned int parse_known_hosts
unsigned int scroll_method
gboolean drun_reload_desktop_cache
unsigned int fixed_num_lines
gboolean xserver_i300_workaround
unsigned int drun_show_actions
unsigned int max_history_size
unsigned int case_sensitive
char * drun_display_format
gboolean combi_hide_mode_prefix
char * window_match_fields
gboolean window_thumbnail
unsigned int sidebar_mode
char matching_negate_char
unsigned int refilter_timeout_limit
gboolean drun_use_desktop_cache
char * combi_display_format
union XrmOption::@5 value
Property * rofi_theme_property_copy(const Property *p, G_GNUC_UNUSED void *data)
void rofi_theme_print_index(ThemeWidget *widget, int index)
void rofi_theme_property_free(Property *p)
gboolean rofi_theme_parse_string(const char *string)
static void print_option_snumber(XrmOption *xo, int is_term)
static void print_option(XrmOption *xo, int is_term)
const char *const ConfigSourceStr[]
XrmOption * extra_options
static gboolean __config_parser_set_property(XrmOption *option, const Property *p, char **error)
static void print_option_char(XrmOption *xo, int is_term)
GList * extra_parsed_options
static gboolean config_parser_form_rasi_format(GString *str, char **tokens, int count, char *argv, gboolean string)
ThemeWidget * rofi_configuration
static XrmOption xrmOptions[]
static void print_option_boolean(XrmOption *xo, int is_term)
static char * config_parser_return_display_help_entry(XrmOption *option, size_t l)
unsigned int num_extra_options
static void print_option_number(XrmOption *xo, int is_term)
static void config_parse_cmd_option(XrmOption *option)
static void config_parse_dump_config_option(FILE *out, XrmOption *option)
static void print_option_string(XrmOption *xo, int is_term)