31#define G_LOG_DOMAIN "Helper"
44#include <glib/gstdio.h>
46#include <pango/pango-fontmap.h>
47#include <pango/pango.h>
48#include <pango/pangocairo.h>
59 "Normal",
"Regex",
"Glob",
"Fuzzy",
"Prefix"};
72 "on focused monitor",
"on focused window",
"at mouse pointer",
73 "on monitor with focused window",
"on monitor that has mouse pointer"};
104 GError *error = NULL;
106 h = g_hash_table_new(g_str_hash, g_str_equal);
108 g_hash_table_insert(h,
"{terminal}",
config.terminal_emulator);
109 g_hash_table_insert(h,
"{ssh-client}",
config.ssh_client);
112 va_start(ap, length);
114 char *key = va_arg(ap,
char *);
115 if (key == (
char *)0) {
118 char *value = va_arg(ap,
char *);
119 if (value == (
char *)0) {
122 g_hash_table_insert(h, key, value);
128 g_hash_table_destroy(h);
130 if (g_shell_parse_argv(res, length, output, &error)) {
137 char *msg = g_strdup_printf(
"Failed to parse: '%s'\nError: '%s'",
string,
148 for (
size_t i = 0; tokens && tokens[i]; i++) {
149 g_regex_unref((GRegex *)tokens[i]->regex);
156 gchar *r = g_regex_escape_string(input, -1);
157 size_t str_l = strlen(r);
158 for (
size_t i = 0; i < str_l; i++) {
160 if (r[i + 1] ==
'*') {
162 }
else if (r[i + 1] ==
'?') {
172 GString *str = g_string_new(
"");
173 gchar *r = g_regex_escape_string(input, -1);
176 for (iter = r; iter && *iter !=
'\0'; iter = g_utf8_next_char(iter)) {
178 g_string_append(str,
"(");
180 g_string_append(str,
".*?(");
183 g_string_append_c(str,
'\\');
184 iter = g_utf8_next_char(iter);
186 if ((*iter) ==
'\0') {
190 g_string_append_unichar(str, g_utf8_get_char(iter));
191 g_string_append(str,
")");
195 retv = g_string_free(str, FALSE);
200 gchar *r = g_regex_escape_string(input, -1);
201 char *retv = g_strconcat(
"\\b", r, NULL);
213 char *s = g_utf8_normalize(os, -1, G_NORMALIZE_ALL);
214 ssize_t str_size = (g_utf8_strlen(s, -1) * 6 + 2 + 1) *
sizeof(
char);
215 char *str = g_malloc0(str_size);
217 for (
const char *iter = s; iter && *iter; iter = g_utf8_next_char(iter)) {
218 gunichar uc = g_utf8_get_char(iter);
219 if (!g_unichar_ismark(uc)) {
220 int l = g_unichar_to_utf8(uc, buf);
221 memcpy(striter, buf, l);
231static inline GRegex *
R(
const char *s,
int case_sensitive) {
232 if (
config.normalize_match) {
235 GRegex *r = g_regex_new(
236 str, G_REGEX_OPTIMIZE | ((case_sensitive) ? 0 : G_REGEX_CASELESS), 0,
243 s, G_REGEX_OPTIMIZE | ((case_sensitive) ? 0 : G_REGEX_CASELESS), 0, NULL);
250 if (input && input[0] ==
config.matching_negate_char) {
254 switch (
config.matching_method) {
257 retv =
R(r, case_sensitive);
261 retv =
R(input, case_sensitive);
263 r = g_regex_escape_string(input, -1);
264 retv =
R(r, case_sensitive);
270 retv =
R(r, case_sensitive);
275 retv =
R(r, case_sensitive);
279 r = g_regex_escape_string(input, -1);
280 retv =
R(r, case_sensitive);
291 size_t len = strlen(input);
296 char *saveptr = NULL, *token;
308 char *str = g_strdup(input);
312 const char *
const sep =
" ";
313 for (token = strtok_r(str, sep, &saveptr); token != NULL;
314 token = strtok_r(NULL, sep, &saveptr)) {
317 retv[num_tokens + 1] = NULL;
346 const char **retv = NULL;
354 retv = g_malloc0((length + 1) *
sizeof(
char *));
368 if (val != NULL && i > 0 && i < (
stored_argc - 1)) {
377 if (val != NULL && i > 0 && i < (
stored_argc - 1)) {
385 const size_t len = strlen(arg);
391 if (len == 2 && arg[0] ==
'\\') {
424 if (len > 2 && arg[0] ==
'\\' && arg[1] ==
'x') {
425 return (
char)strtol(&arg[2], NULL, 16);
427 g_warning(
"Failed to parse character string: \"%s\"", arg);
435 if (val != NULL && i > 0 && i < (
stored_argc - 1)) {
446 PangoAttribute *pa = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
447 pa->start_index = start;
449 pango_attr_list_insert(retv, pa);
451#if PANGO_VERSION_CHECK(1, 50, 0)
454 pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_UPPERCASE);
455 pa->start_index = start;
457 pango_attr_list_insert(retv, pa);
461 pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_LOWERCASE);
462 pa->start_index = start;
464 pango_attr_list_insert(retv, pa);
469 pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_CAPITALIZE);
470 pa->start_index = start;
472 pango_attr_list_insert(retv, pa);
478 PangoAttribute *pa = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
479 pa->start_index = start;
481 pango_attr_list_insert(retv, pa);
484 PangoAttribute *pa = pango_attr_strikethrough_new(TRUE);
485 pa->start_index = start;
487 pango_attr_list_insert(retv, pa);
490 PangoAttribute *pa = pango_attr_style_new(PANGO_STYLE_ITALIC);
491 pa->start_index = start;
493 pango_attr_list_insert(retv, pa);
496 PangoAttribute *pa = pango_attr_foreground_new(
498 pa->start_index = start;
500 pango_attr_list_insert(retv, pa);
503 pa = pango_attr_foreground_alpha_new(th.
color.
alpha * 65535);
504 pa->start_index = start;
506 pango_attr_list_insert(retv, pa);
514 PangoAttrList *retv) {
516 if (
config.normalize_match) {
521 for (
int j = 0; tokens[j]; j++) {
522 GMatchInfo *gmi = NULL;
523 if (tokens[j]->invert) {
526 g_regex_match(tokens[j]->regex, input, G_REGEX_MATCH_PARTIAL, &gmi);
527 while (g_match_info_matches(gmi)) {
528 int count = g_match_info_get_match_count(gmi);
529 for (
int index = (
count > 1) ? 1 : 0; index <
count; index++) {
531 g_match_info_fetch_pos(gmi, index, &start, &end);
534 g_match_info_next(gmi, NULL);
536 g_match_info_free(gmi);
546 if (
config.normalize_match) {
548 for (
int j = 0; match && tokens[j]; j++) {
549 match = g_regex_match(tokens[j]->regex, r, 0, NULL);
550 match ^= tokens[j]->invert;
554 for (
int j = 0; match && tokens[j]; j++) {
555 match = g_regex_match(tokens[j]->regex, input, 0, NULL);
556 match ^= tokens[j]->invert;
569 GError *error = NULL;
570 g_spawn_async_with_pipes(NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
571 NULL, NULL, &fd, NULL, &error);
574 char *msg = g_strdup_printf(
"Failed to execute: '%s'\nError: '%s'", cmd,
591 int fd = g_open(
pidfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
593 g_warning(
"Failed to create pid file: '%s'.",
pidfile);
597 int flags = fcntl(fd, F_GETFD, NULL);
599 if (fcntl(fd, F_SETFD,
flags, NULL) < 0) {
600 g_warning(
"Failed to set CLOEXEC on pidfile.");
605 int retv = flock(fd, LOCK_EX | LOCK_NB);
607 g_warning(
"Failed to set lock on pidfile: Rofi already running?");
608 g_warning(
"Got error: %d %s", retv, g_strerror(errno));
613 ssize_t l = read(fd, &(buffer[0]), 63);
616 pid_t pid = g_ascii_strtoll(buffer, NULL, 0);
619 retv = flock(fd, LOCK_EX | LOCK_NB);
633 if (ftruncate(fd, (off_t)0) == 0) {
636 int length = snprintf(buffer, 64,
"%i", getpid());
639 l += write(fd, &buffer[l], length - l);
648 g_warning(
"Failed to close pidfile: '%s'", g_strerror(errno));
654 const char *fam = pango_font_description_get_family(pfd);
655 int size = pango_font_description_get_size(pfd);
656 if (fam == NULL || size == 0) {
657 g_debug(
"Pango failed to parse font: '%s'", font);
658 g_debug(
"Got family: <b>%s</b> at size: <b>%d</b>", fam ? fam :
"{unknown}",
673 int found_error = FALSE;
675 g_string_new(
"<big><b>The configuration failed to validate:</b></big>\n");
677 if (
config.sorting_method) {
678 if (g_strcmp0(
config.sorting_method,
"normal") == 0) {
680 }
else if (g_strcmp0(
config.sorting_method,
"levenshtein") == 0) {
682 }
else if (g_strcmp0(
config.sorting_method,
"fzf") == 0) {
685 g_string_append_printf(
687 "\t<b>config.sorting_method</b>=%s is not a valid sorting "
688 "strategy.\nValid options are: normal or fzf.\n",
695 char **strv = g_strsplit(
config.matching,
",", 0);
697 int matching_method_index = 0;
698 for (
char **str = strv; *str && matching_method_index <
MM_NUM_MATCHERS;
700 gboolean found = FALSE;
706 matching_method_index++;
710 g_string_append_printf(msg,
711 "\t<b>config.matching</b> = %s to many "
712 "matching options enabled.\n",
719 g_string_append_printf(msg,
720 "\t<b>config.matching</b>=%s is not a valid "
721 "matching strategy.\nValid options are: glob, "
722 "regex, fuzzy, prefix or normal.\n",
732 if (
config.element_height < 1) {
733 g_string_append_printf(msg,
734 "\t<b>config.element_height</b>=%d is invalid. An "
735 "element needs to be at least 1 line high.\n",
737 config.element_height = 1;
741 g_string_append_printf(msg,
742 "\t<b>config.location</b>=%d is invalid. Value "
743 "should be between %d and %d.\n",
753 const char *name =
config.monitor;
754 if (name && name[0] ==
'-') {
755 int index = name[1] -
'0';
756 if (index < 5 && index > 0) {
760 g_string_append_printf(
761 msg,
"\t<b>config.monitor</b>=%s Could not find monitor.\n", name);
766 if (g_strcmp0(
config.monitor,
"-3") == 0) {
772 g_string_append(msg,
"Please update your configuration.");
777 g_string_free(msg, TRUE);
782 char **str = g_strsplit(input, G_DIR_SEPARATOR_S, -1);
783 for (
unsigned int i = 0; str && str[i]; i++) {
785 if (str[i][0] ==
'~' && str[i][1] ==
'\0') {
787 str[i] = g_strdup(g_get_home_dir());
790 else if (str[i][0] ==
'~') {
791 struct passwd *p = getpwnam(&(str[i][1]));
794 str[i] = g_strdup(p->pw_dir);
798 if (input[0] == G_DIR_SEPARATOR) {
799 str[i] = g_strdup_printf(
"%s%s", G_DIR_SEPARATOR_S, s);
804 char *retv = g_build_filenamev(str);
810#define MIN3(a, b, c) \
811 ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
813unsigned int levenshtein(
const char *needle,
const glong needlelen,
814 const char *haystack,
const glong haystacklen,
815 int case_sensitive) {
816 if (needlelen == G_MAXLONG) {
820 unsigned int column[needlelen + 1];
821 for (glong y = 0; y < needlelen; y++) {
826 column[needlelen] = needlelen;
827 for (glong x = 1; x <= haystacklen; x++) {
828 const char *needles = needle;
830 gunichar haystackc = g_utf8_get_char(haystack);
831 if (!case_sensitive) {
832 haystackc = g_unichar_tolower(haystackc);
834 for (glong y = 1, lastdiag = x - 1; y <= needlelen; y++) {
835 gunichar needlec = g_utf8_get_char(needles);
836 if (!case_sensitive) {
837 needlec = g_unichar_tolower(needlec);
839 unsigned int olddiag = column[y];
840 column[y] =
MIN3(column[y] + 1, column[y - 1] + 1,
841 lastdiag + (needlec == haystackc ? 0 : 1));
843 needles = g_utf8_next_char(needles);
845 haystack = g_utf8_next_char(haystack);
847 return column[needlelen];
852 return g_convert_with_fallback(input, length,
"UTF-8",
"latin1",
"\uFFFD",
853 NULL, &slength, NULL);
863 if (g_utf8_validate(data, length, &end)) {
864 return g_memdup2(data, length + 1);
866 string = g_string_sized_new(length + 16);
870 g_string_append_len(
string, data, end - data);
872 g_string_append(
string,
"\uFFFD");
873 length -= (end - data) + 1;
875 }
while (!g_utf8_validate(data, length, &end));
878 g_string_append_len(
string, data, length);
881 return g_string_free(
string, FALSE);
889#define FUZZY_SCORER_MAX_LENGTH 256
891#define MIN_SCORE (INT_MIN / 2)
893#define LEADING_GAP_SCORE -4
897#define WORD_START_SCORE 50
899#define NON_WORD_SCORE 40
901#define CAMEL_SCORE (WORD_START_SCORE + GAP_SCORE - 1)
903#define CONSECUTIVE_SCORE (WORD_START_SCORE + GAP_SCORE)
905#define PATTERN_NON_START_MULTIPLIER 1
907#define PATTERN_START_MULTIPLIER 2
929 if (g_unichar_islower(c)) {
932 if (g_unichar_isupper(c)) {
935 if (g_unichar_isdigit(c)) {
963 glong slen,
int case_sensitive) {
969 gboolean pfirst = TRUE;
971 gboolean pstart = TRUE;
973 int *score = g_malloc_n(slen,
sizeof(
int));
975 int *dp = g_malloc_n(slen,
sizeof(
int));
978 int uleft = 0, ulefts = 0, left, lefts;
979 const gchar *pit = pattern, *sit;
981 for (si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char(sit)) {
987 for (pi = 0; pi < plen; pi++, pit = g_utf8_next_char(pit)) {
988 gunichar pc = g_utf8_get_char(pit), sc;
989 if (g_unichar_isspace(pc)) {
994 for (si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char(sit)) {
997 sc = g_utf8_get_char(sit);
998 if (case_sensitive ? pc == sc
999 : g_unichar_tolower(pc) == g_unichar_tolower(sc)) {
1010 pfirst = pstart = FALSE;
1013 for (si = 0; si < slen; si++) {
1033 char *na = g_utf8_normalize(a, -1, G_NORMALIZE_ALL_COMPOSE);
1034 char *nb = g_utf8_normalize(b, -1, G_NORMALIZE_ALL_COMPOSE);
1035 *g_utf8_offset_to_pointer(na, n) =
'\0';
1036 *g_utf8_offset_to_pointer(nb, n) =
'\0';
1037 int r = g_utf8_collate(na, nb);
1044 const char *error_cmd,
1046 gboolean retv = TRUE;
1047 GError *error = NULL;
1049 GSpawnChildSetupFunc child_setup = NULL;
1050 gpointer user_data = NULL;
1054 g_spawn_async(wd, args, NULL, G_SPAWN_SEARCH_PATH, child_setup, user_data,
1056 if (error != NULL) {
1057 char *msg = g_strdup_printf(
"Failed to execute: '%s%s'\nError: '%s'",
1058 error_precmd, error_cmd, error->message);
1062 g_error_free(error);
1072 gboolean run_in_term,
1089 if (context != NULL) {
1090 if (context->
name == NULL) {
1091 context->
name = args[0];
1093 if (context->
binary == NULL) {
1094 context->
binary = args[0];
1097 gsize l = strlen(
"Launching '' via rofi") + strlen(cmd) + 1;
1098 gchar *description = g_newa(gchar, l);
1100 g_snprintf(description, l,
"Launching '%s' via rofi", cmd);
1103 if (context->
command == NULL) {
1112 const char *parent_file) {
1115 if (g_path_is_absolute(filename)) {
1116 g_debug(
"Opening theme, path is absolute: %s", filename);
1117 if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
1118 return g_strdup(filename);
1120 g_debug(
"Opening theme, path is absolute but does not exists: %s",
1123 if (parent_file != NULL) {
1125 char *basedir = g_path_get_dirname(parent_file);
1126 char *path = g_build_filename(basedir, filename, NULL);
1128 g_debug(
"Opening theme, check in dir where file is included: %s", path);
1129 if (g_file_test(path, G_FILE_TEST_EXISTS)) {
1132 g_debug(
"Opening theme, file does not exists in dir where file is "
1138 const char *cpath = g_get_user_config_dir();
1140 char *themep = g_build_filename(cpath,
"rofi",
"themes", filename, NULL);
1141 g_debug(
"Opening theme, testing: %s", themep);
1142 if (themep && g_file_test(themep, G_FILE_TEST_EXISTS)) {
1149 char *themep = g_build_filename(cpath,
"rofi", filename, NULL);
1150 g_debug(
"Opening theme, testing: %s", themep);
1151 if (g_file_test(themep, G_FILE_TEST_EXISTS)) {
1156 const char *datadir = g_get_user_data_dir();
1159 g_build_filename(datadir,
"rofi",
"themes", filename, NULL);
1161 g_debug(
"Opening theme, testing: %s", theme_path);
1162 if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
1169 const gchar *
const *system_data_dirs = g_get_system_data_dirs();
1170 if (system_data_dirs) {
1171 for (uint_fast32_t i = 0; system_data_dirs[i] != NULL; i++) {
1172 const char *
const sdatadir = system_data_dirs[i];
1173 g_debug(
"Opening theme directory: %s", sdatadir);
1175 g_build_filename(sdatadir,
"rofi",
"themes", filename, NULL);
1177 g_debug(
"Opening theme, testing: %s", theme_path);
1178 if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
1186 char *theme_path = g_build_filename(THEME_DIR, filename, NULL);
1188 g_debug(
"Opening theme, testing: %s", theme_path);
1189 if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
1198 const char *parent_file) {
1201 g_debug(
"Opening theme, testing: %s\n", filename);
1202 if (g_path_is_absolute(filename)) {
1203 g_debug(
"Opening theme, path is absolute: %s", filename);
1204 if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
1208 gboolean ext_found = FALSE;
1209 for (
const char **i = ext; *i != NULL; i++) {
1210 if (g_str_has_suffix(file, *i)) {
1224 g_assert_nonnull(ext[0]);
1226 char *temp = filename;
1227 for (
const char **i = ext; *i != NULL; i++) {
1228 filename = g_strconcat(temp, *i, NULL);
1244 while (input != NULL && isblank(*input)) {
1248 if (input == NULL) {
1252 const char *sep[] = {
"-",
":"};
1253 int pythonic = (strchr(input,
':') || input[0] ==
'-') ? 1 : 0;
1256 for (
char *token = strsep(&input, sep[pythonic]); token != NULL;
1257 token = strsep(&input, sep[pythonic])) {
1259 item->
start = item->
stop = (int)strtol(token, NULL, 10);
1264 if (token[0] ==
'\0') {
1269 item->
stop = (int)strtol(token, NULL, 10);
1278 if (input == NULL) {
1281 const char *
const sep =
",";
1282 for (
char *token = strtok_r(input, sep, &endp); token != NULL;
1283 token = strtok_r(NULL, sep, &endp)) {
1288 if (
parse_pair(token, &((*list)[*length]))) {
1295 int case_sensitive =
config.case_sensitive;
1299 case_sensitive = FALSE;
1301 if (g_utf8_validate(input, -1, &end)) {
1302 for (
const char *c = (input); !case_sensitive && c != NULL && *c;
1303 c = g_utf8_next_char(c)) {
1304 gunichar uc = g_utf8_get_char(c);
1305 if (g_unichar_isupper(uc)) {
1306 case_sensitive = TRUE;
1312 return case_sensitive;
1316 int selected_line,
const char *filter) {
1317 for (
int i = 0; format && format[i]; i++) {
1318 if (format[i] ==
'i') {
1319 fprintf(stdout,
"%d", selected_line);
1320 }
else if (format[i] ==
'd') {
1321 fprintf(stdout,
"%d", (selected_line + 1));
1322 }
else if (format[i] ==
's') {
1323 fputs(
string, stdout);
1324 }
else if (format[i] ==
'p') {
1326 pango_parse_markup(
string, -1, 0, NULL, &esc, NULL, NULL);
1331 fputs(
"invalid string", stdout);
1333 }
else if (format[i] ==
'q') {
1334 char *quote = g_shell_quote(
string);
1335 fputs(quote, stdout);
1337 }
else if (format[i] ==
'f') {
1339 fputs(filter, stdout);
1341 }
else if (format[i] ==
'F') {
1343 char *quote = g_shell_quote(filter);
1344 fputs(quote, stdout);
1348 fputc(format[i], stdout);
1351 fputc(
'\n', stdout);
1359 int num_match = g_match_info_get_match_count(info);
1361 if (num_match == 5) {
1362 match = g_match_info_fetch(info, 4);
1363 if (match != NULL) {
1365 gchar *r = g_hash_table_lookup((GHashTable *)data, match);
1368 g_string_append(res, r);
1375 else if (num_match == 4) {
1376 match = g_match_info_fetch(info, 2);
1377 if (match != NULL) {
1379 gchar *r = g_hash_table_lookup((GHashTable *)data, match);
1382 gchar *prefix = g_match_info_fetch(info, 1);
1383 g_string_append(res, prefix);
1386 g_string_append(res, r);
1388 gchar *post = g_match_info_fetch(info, 3);
1389 g_string_append(res, post);
1403 h = g_hash_table_new(g_str_hash, g_str_equal);
1405 va_start(ap,
string);
1408 char *key = va_arg(ap,
char *);
1409 if (key == (
char *)0) {
1412 char *value = va_arg(ap,
char *);
1413 g_hash_table_insert(h, key, value);
1418 g_hash_table_destroy(h);
1437 GError *error = NULL;
1441 GRegex *reg = g_regex_new(
"\\[(.*)({[-\\w]+})(.*)\\]|({[\\w-]+})",
1442 G_REGEX_UNGREEDY, 0, &error);
1443 if (error == NULL) {
1445 g_regex_replace_eval(reg,
string, -1, 0, 0,
helper_eval_cb2, h, &error);
1450 if (error != NULL) {
1451 char *msg = g_strdup_printf(
"Failed to parse: '%s'\nError: '%s'",
string,
1456 g_error_free(error);
void helper_token_match_set_pango_attr_on_style(PangoAttrList *retv, int start, int end, RofiHighlightColorStyle th)
PangoAttrList * helper_token_match_get_pango_attr(RofiHighlightColorStyle th, rofi_int_matcher **tokens, const char *input, PangoAttrList *retv)
gboolean helper_validate_font(PangoFontDescription *pfd, const char *font)
char * rofi_latin_to_utf8_strdup(const char *input, gssize length)
void parse_ranges(char *input, rofi_range_pair **list, unsigned int *length)
void cmd_set_arguments(int argc, char **argv)
rofi_int_matcher ** helper_tokenize(const char *input, int case_sensitive)
unsigned int levenshtein(const char *needle, const glong needlelen, const char *haystack, const glong haystacklen, int case_sensitive)
int find_arg_char(const char *const key, char *val)
gboolean helper_execute_command(const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context)
void helper_select_next_matching_mode(void)
void helper_tokenize_free(rofi_int_matcher **tokens)
char helper_parse_char(const char *arg)
void rofi_output_formatted_line(const char *format, const char *string, int selected_line, const char *filter)
const char * helper_get_matching_mode_str(void)
gboolean helper_execute(const char *wd, char **args, const char *error_precmd, const char *error_cmd, RofiHelperExecuteContext *context)
char * helper_string_replace_if_exists(char *string,...)
const char ** find_arg_strv(const char *const key)
int helper_parse_setup(char *string, char ***output, int *length,...)
int execute_generator(const char *cmd)
void helper_select_previous_matching_mode(void)
int find_arg_int(const char *const key, int *val)
char * rofi_expand_path(const char *input)
void remove_pid_file(int fd)
int find_arg_str(const char *const key, char **val)
int parse_case_sensitivity(const char *input)
int rofi_scorer_fuzzy_evaluate(const char *pattern, glong plen, const char *str, glong slen, int case_sensitive)
int find_arg_uint(const char *const key, unsigned int *val)
int find_arg(const char *const key)
int helper_token_match(rofi_int_matcher *const *tokens, const char *input)
int create_pid_file(const char *pidfile, gboolean kill_running)
int config_sanity_check(void)
char * rofi_force_utf8(const gchar *data, ssize_t length)
void rofi_add_error_message(GString *str)
int rofi_view_error_dialog(const char *msg, int markup)
#define CONSECUTIVE_SCORE
#define LEADING_GAP_SCORE
static gchar * prefix_regex(const char *input)
static int MatchingMethodEnabled[MM_NUM_MATCHERS]
static char * utf8_helper_simplify_string(const char *os)
static gchar * glob_to_regex(const char *input)
const char *const monitor_position_entries[]
static enum CharClass rofi_scorer_get_character_class(gunichar c)
int utf8_strncmp(const char *a, const char *b, size_t n)
#define PATTERN_NON_START_MULTIPLIER
char * helper_string_replace_if_exists_v(char *string, GHashTable *h)
static int NUMMatchingMethodEnabled
static char * helper_get_theme_path_check_file(const char *filename, const char *parent_file)
static int CurrentMatchingMethod
#define FUZZY_SCORER_MAX_LENGTH
static gboolean helper_eval_cb2(const GMatchInfo *info, GString *res, gpointer data)
#define PATTERN_START_MULTIPLIER
char * helper_get_theme_path(const char *file, const char **ext, const char *parent_file)
static rofi_int_matcher * create_regex(const char *input, int case_sensitive)
static GRegex * R(const char *s, int case_sensitive)
static gchar * fuzzy_to_regex(const char *input)
const char *const MatchingMethodStr[MM_NUM_MATCHERS]
static gboolean parse_pair(char *input, rofi_range_pair *item)
static int rofi_scorer_get_score_for(enum CharClass prev, enum CharClass curr)
struct rofi_int_matcher_t rofi_int_matcher
const gchar * description
int monitor_active(workarea *mon)
void display_startup_notification(RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data)
struct _workarea workarea