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",
136 "Custom command to generate preview icons",
155 "Ssh command to execute",
161 "Run command to execute",
167 "Command to get extra run targets",
173 "Run command to execute that runs in shell",
179 "Command to executed when -kb-accept-alt binding is hit on selected "
183 "window-match-fields",
186 "Window fields to match in window mode",
192 "Theme to use to look for icons",
199 "Desktop entry fields to match in drun",
205 "Only show Desktop entry from these categories",
211 "Desktop entry show actions.",
214 "drun-display-format",
217 "DRUN format string. (Supports: generic,name,comment,exec,categories)",
223 "Command to open a Desktop Entry that is a Link.",
230 "Disable history in run/ssh",
236 "Programs ignored for history",
242 "Sort menu when filtered",
248 "Choose sort strategy: normal (levenshtein) or fzf.",
254 "Set case-sensitivity",
260 "Cycle through the results list",
266 "Enable sidebar-mode",
272 "Enable hover-select",
278 "Row height (in chars)",
284 "Enable auto select mode",
290 "Parse hosts file for ssh mode",
296 "Parse known_hosts file for ssh mode",
302 "Set the modes to combine in combi mode",
308 "Set the modes to combine in combi mode",
314 "Set the matching algorithm. (normal, regex, glob, fuzzy, prefix)",
320 "Tokenize input string",
328 "Monitor id to show on",
341 "Threads to use for string matching",
347 "Scrolling method. (0: Page, 1: Centered)",
353 "Window Format. w (desktop name), t (title), n (name), r (role), c "
360 "Click outside the window to exit",
366 "New style theme file",
372 "Max history size (WARNING: can cause slowdowns when set too high).",
375 "combi-hide-mode-prefix",
378 "Hide the prefix mode prefix on the combi view.**deprecated** use "
379 "combi-display-format",
382 "combi-display-format",
385 "Combi format string. (Supports: mode, text)",
388 "matching-negate-char",
391 "Set the character used to negate the matching. ('\\0' to disable)",
397 "Directory where history and temporary files are stored.",
403 "Show window thumbnail (if available) as icon in window switcher.",
406 "drun-use-desktop-cache",
409 "DRUN: build and use a cache with desktop file content.",
412 "drun-reload-desktop-cache",
415 "DRUN: If enabled, reload the cache with desktop file content.",
421 "Normalize string when matching (disables match highlighting).",
427 "Steal focus on launch and restore to window that had it on rofi start on "
431 "application-fallback-icon",
434 "Fallback icon to use when the application icon is not found in run/drun.",
437 "refilter-timeout-limit",
440 "When filtering takes more then this time (in ms) switch to delayed "
444 "xserver-i300-workaround",
447 "Workaround for XServer issue #300 (issue #611 for rofi.)",
453 "What completer to use for drun/run.",
469 const char *comment) {
488 iter = g_list_next(iter)) {
489 if (g_strcmp0(((
Property *)(iter->data))->name, key) == 0) {
491 g_debug(
"Setting property from backup list: %s", key);
493 (
Property *)(iter->data), &error)) {
494 g_debug(
"Failed to set property on custom entry: %s", key);
509 char *key = g_strdup_printf(
"-%s", option->
name);
510 switch (option->
type) {
523 if (option->
mem != NULL) {
536 key = g_strdup_printf(
"-no-%s", option->
name);
555 int count,
char *argv,
557 if (strlen(argv) > 4096) {
560 for (
int j = 0; j < (
count - 1); j++) {
561 g_string_append_printf(str,
"%s { ", tokens[j]);
564 char *esc = g_strescape(argv, NULL);
565 g_string_append_printf(str,
"%s: \"%s\";", tokens[
count - 1], esc);
568 g_string_append_printf(str,
"%s: %s;", tokens[
count - 1], argv);
570 for (
int j = 0; j < (
count - 1); j++) {
571 g_string_append(str,
" } ");
596 char **tokens = g_strsplit(
stored_argv[in],
"-", 3);
598 for (
int j = 1; tokens && tokens[j]; j++) {
602 if (g_str_has_prefix(tokens[1],
"theme")) {
605 count = g_strv_length(tokens);
607 GString *str = g_string_new(
"");
613 g_string_free(str, TRUE);
616 g_string_free(str, TRUE);
618 }
else if (g_strcmp0(tokens[1],
"no") != 0) {
619 GString *str = g_string_new(
"configuration { ");
622 g_string_append(str,
"}");
623 g_debug(
"str: \"%s\"\n", str->str);
627 g_string_assign(str,
"configuration { ");
630 g_string_append(str,
"}");
631 g_debug(
"str: \"%s\"\n", str->str);
637 g_string_free(str, TRUE);
651 g_strdup_printf(
"Option: %s needs to be set with a string not a %s.",
657 for (GList *iter = p->
value.
list; iter != NULL;
658 iter = g_list_next(iter)) {
661 value = g_strdup((
char *)(p2->
value.
s));
663 char *nv = g_strjoin(
",", value, (
char *)(p2->
value.
s), NULL);
669 value = g_strdup_printf(
"%d", p->
value.
i);
671 value = g_strdup(p->
value.
s);
673 if ((option)->mem != NULL) {
680 (option)->mem = *(option->
value.
str);
685 g_strdup_printf(
"Option: %s needs to be set with a number not a %s.",
694 g_strdup_printf(
"Option: %s needs to be set with a number not a %s.",
703 g_strdup_printf(
"Option: %s needs to be set with a boolean not a %s.",
713 g_strdup_printf(
"Option: %s needs to be set with a string not a %s.",
721 *error = g_strdup_printf(
"Option: %s is not of a supported type: %s.",
729 if (g_ascii_strcasecmp(p->
name,
"theme") == 0) {
731 *error = g_strdup_printf(
"The option:\n<b>\nconfiguration\n{\n\ttheme: "
732 "\"%s\";\n}</b>\nis deprecated. Please replace "
733 "with: <b>@theme \"%s\"</b> "
734 "after the configuration block.",
737 *error = g_strdup_printf(
"The option:\n<b>\nconfiguration\n{\n\ttheme: "
738 "\"%s\";\n}</b>\nis deprecated. Please replace "
739 "with: <b>@theme \"%s\"</b> "
740 "after the configuration block.",
741 "myTheme",
"myTheme");
747 if (g_strcmp0(op->
name, p->
name) == 0) {
753 if (g_strcmp0(op->
name, p->
name) == 0) {
758 g_debug(
"Option: %s is not found.", p->
name);
761 iter = g_list_next(iter)) {
762 if (g_strcmp0(((
Property *)(iter->data))->name, p->
name) == 0) {
768 g_debug(
"Adding option: %s to backup list.", p->
name);
776 for (
unsigned int i = 0; i < (
sizeof(
xrmOptions) /
sizeof(*xrmOptions));
800 fprintf(out,
"\t%s: ", option->
name);
801 switch (option->
type) {
803 fprintf(out,
"%u", *(option->
value.
num));
806 fprintf(out,
"%i", *(option->
value.
snum));
809 if ((*(option->
value.
str)) != NULL) {
811 fprintf(out,
"\"%s\"", *(option->
value.
str));
815 fprintf(out,
"%s", (*(option->
value.
num) == TRUE) ?
"true" :
"false");
822 fprintf(out,
"'\\x%02X'", *(option->
value.
charc));
824 fprintf(out,
" /* unsupported */");
838 fprintf(out,
"configuration {\n");
841 for (
unsigned int i = 0; i < entries; ++i) {
843 if ((i + 1) < entries) {
878 int l = strlen(xo->
name);
887 printf(
"\t-%s [string]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
894 int l = strlen(xo->
name);
902 printf(
"\t-%s [number]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
908 int l = strlen(xo->
name);
916 printf(
"\t-%s [number]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
922 int l = strlen(xo->
name);
930 printf(
"\t-%s [character]%-*c%s\n", xo->
name, 30 - l,
' ', xo->
comment);
936 int l = strlen(xo->
name);
945 printf(
"\t-[no-]%s %-*c%s\n", xo->
name, 33 - l,
' ', xo->
comment);
946 printf(
"\t\t%s", (*(xo->
value.
snum)) ?
"True" :
"False");
977 int is_term = isatty(fileno(stdout));
979 for (
unsigned int i = 0; i < entries; ++i) {
980 if ((i + 1) < entries) {
993 const char *def,
int isatty) {
994 int l = 37 - strlen(option) - strlen(type);
1002 printf(
"\t%s %s %-*c%s\n", option, type, l,
' ', text);
1004 printf(
"\t\t%s\n", def);
1012 switch (option->
type) {
1014 return g_markup_printf_escaped(
1015 "<b%-*s</b> (%u) <span style='italic' size='small'>%s</span>", ll,
1018 return g_markup_printf_escaped(
1019 "<b%-*s</b> (%d) <span style='italic' size='small'>%s</span>", ll,
1022 return g_markup_printf_escaped(
1023 "<b>%-*s</b> (%s) <span style='italic' size='small'>%s</span>", ll,
1028 return g_markup_printf_escaped(
1029 "<b>%-*s</b> (%s) <span style='italic' size='small'>%s</span>", ll,
1030 option->
name, (*(option->
value.
num) == TRUE) ?
"true" :
"false",
1034 return g_markup_printf_escaped(
1035 "<b>%-*s</b> (%c) <span style='italic' size='small'>%s</span>", ll,
1038 return g_markup_printf_escaped(
1039 "<b%-*s</b> (\\x%02X) <span style='italic' size='small'>%s</span>",
1046 return g_strdup(
"failed");
1055 size_t max_length = 0;
1056 for (
unsigned int i = 0; i < entries; ++i) {
1058 max_length = MAX(max_length, l);
1062 max_length = MAX(max_length, l);
1067 for (
unsigned int i = 0; i < entries; ++i) {
1068 if ((i + 1) < entries) {
1073 if (strncmp(
xrmOptions[i].name,
"kb", 2) != 0 &&
1079 retv = g_realloc(retv, ((*length) + 2) *
sizeof(
char *));
1091 retv = g_realloc(retv, ((*length) + 2) *
sizeof(
char *));
1096 if ((*length) > 0) {
1097 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
void rofi_theme_print_index(ThemeWidget *wid, int index)
Property * rofi_theme_property_copy(const Property *p, G_GNUC_UNUSED void *data)
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)