31#define G_LOG_DOMAIN "Helper"
43#include <glib/gstdio.h>
45#include <pango/pango-fontmap.h>
46#include <pango/pango.h>
47#include <pango/pangocairo.h>
58 "Normal",
"Regex",
"Glob",
"Fuzzy",
"Prefix"};
71 "on focused monitor",
"on focused window",
"at mouse pointer",
72 "on monitor with focused window",
"on monitor that has mouse pointer"};
103 GError *error = NULL;
105 h = g_hash_table_new(g_str_hash, g_str_equal);
107 g_hash_table_insert(h,
"{terminal}",
config.terminal_emulator);
108 g_hash_table_insert(h,
"{ssh-client}",
config.ssh_client);
111 va_start(ap, length);
113 char *key = va_arg(ap,
char *);
114 if (key == (
char *)0) {
117 char *value = va_arg(ap,
char *);
118 if (value == (
char *)0) {
121 g_hash_table_insert(h, key, value);
127 g_hash_table_destroy(h);
129 if (g_shell_parse_argv(res, length, output, &error)) {
136 char *msg = g_strdup_printf(
"Failed to parse: '%s'\nError: '%s'",
string,
147 for (
size_t i = 0; tokens && tokens[i]; i++) {
148 g_regex_unref((GRegex *)tokens[i]->regex);
155 gchar *r = g_regex_escape_string(input, -1);
156 size_t str_l = strlen(r);
157 for (
size_t i = 0; i < str_l; i++) {
159 if (r[i + 1] ==
'*') {
161 }
else if (r[i + 1] ==
'?') {
171 GString *str = g_string_new(
"");
172 gchar *r = g_regex_escape_string(input, -1);
175 for (iter = r; iter && *iter !=
'\0'; iter = g_utf8_next_char(iter)) {
177 g_string_append(str,
"(");
179 g_string_append(str,
".*?(");
182 g_string_append_c(str,
'\\');
183 iter = g_utf8_next_char(iter);
185 if ((*iter) ==
'\0') {
189 g_string_append_unichar(str, g_utf8_get_char(iter));
190 g_string_append(str,
")");
194 retv = g_string_free(str, FALSE);
199 gchar *r = g_regex_escape_string(input, -1);
200 char *retv = g_strconcat(
"\\b", r, NULL);
212 char *s = g_utf8_normalize(os, -1, G_NORMALIZE_ALL);
213 ssize_t str_size = (g_utf8_strlen(s, -1) * 6 + 2 + 1) *
sizeof(
char);
214 char *str = g_malloc0(str_size);
216 for (
const char *iter = s; iter && *iter; iter = g_utf8_next_char(iter)) {
217 gunichar uc = g_utf8_get_char(iter);
218 if (!g_unichar_ismark(uc)) {
219 int l = g_unichar_to_utf8(uc, buf);
220 memcpy(striter, buf, l);
230static inline GRegex *
R(
const char *s,
int case_sensitive) {
231 if (
config.normalize_match) {
234 GRegex *r = g_regex_new(
235 str, G_REGEX_OPTIMIZE | ((case_sensitive) ? 0 : G_REGEX_CASELESS), 0,
242 s, G_REGEX_OPTIMIZE | ((case_sensitive) ? 0 : G_REGEX_CASELESS), 0, NULL);
249 if (input && input[0] ==
config.matching_negate_char) {
253 switch (
config.matching_method) {
256 retv =
R(r, case_sensitive);
260 retv =
R(input, case_sensitive);
262 r = g_regex_escape_string(input, -1);
263 retv =
R(r, case_sensitive);
269 retv =
R(r, case_sensitive);
274 retv =
R(r, case_sensitive);
278 r = g_regex_escape_string(input, -1);
279 retv =
R(r, case_sensitive);
290 size_t len = strlen(input);
295 char *saveptr = NULL, *token;
307 char *str = g_strdup(input);
311 const char *
const sep =
" ";
312 for (token = strtok_r(str, sep, &saveptr); token != NULL;
313 token = strtok_r(NULL, sep, &saveptr)) {
316 retv[num_tokens + 1] = NULL;
345 const char **retv = NULL;
353 retv = g_malloc0((length + 1) *
sizeof(
char *));
367 if (val != NULL && i > 0 && i < (
stored_argc - 1)) {
376 if (val != NULL && i > 0 && i < (
stored_argc - 1)) {
384 const size_t len = strlen(arg);
390 if (len == 2 && arg[0] ==
'\\') {
423 if (len > 2 && arg[0] ==
'\\' && arg[1] ==
'x') {
424 return (
char)strtol(&arg[2], NULL, 16);
426 g_warning(
"Failed to parse character string: \"%s\"", arg);
434 if (val != NULL && i > 0 && i < (
stored_argc - 1)) {
445 PangoAttribute *pa = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
446 pa->start_index = start;
448 pango_attr_list_insert(retv, pa);
450#if PANGO_VERSION_CHECK(1, 50, 0)
453 pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_UPPERCASE);
454 pa->start_index = start;
456 pango_attr_list_insert(retv, pa);
460 pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_LOWERCASE);
461 pa->start_index = start;
463 pango_attr_list_insert(retv, pa);
468 pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_CAPITALIZE);
469 pa->start_index = start;
471 pango_attr_list_insert(retv, pa);
477 PangoAttribute *pa = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
478 pa->start_index = start;
480 pango_attr_list_insert(retv, pa);
483 PangoAttribute *pa = pango_attr_strikethrough_new(TRUE);
484 pa->start_index = start;
486 pango_attr_list_insert(retv, pa);
489 PangoAttribute *pa = pango_attr_style_new(PANGO_STYLE_ITALIC);
490 pa->start_index = start;
492 pango_attr_list_insert(retv, pa);
495 PangoAttribute *pa = pango_attr_foreground_new(
497 pa->start_index = start;
499 pango_attr_list_insert(retv, pa);
502 pa = pango_attr_foreground_alpha_new(th.
color.
alpha * 65535);
503 pa->start_index = start;
505 pango_attr_list_insert(retv, pa);
513 PangoAttrList *retv) {
515 if (
config.normalize_match) {
520 for (
int j = 0; tokens[j]; j++) {
521 GMatchInfo *gmi = NULL;
522 if (tokens[j]->invert) {
525 g_regex_match(tokens[j]->regex, input, G_REGEX_MATCH_PARTIAL, &gmi);
526 while (g_match_info_matches(gmi)) {
527 int count = g_match_info_get_match_count(gmi);
528 for (
int index = (
count > 1) ? 1 : 0; index <
count; index++) {
530 g_match_info_fetch_pos(gmi, index, &start, &end);
533 g_match_info_next(gmi, NULL);
535 g_match_info_free(gmi);
545 if (
config.normalize_match) {
547 for (
int j = 0; match && tokens[j]; j++) {
548 match = g_regex_match(tokens[j]->regex, r, 0, NULL);
549 match ^= tokens[j]->invert;
553 for (
int j = 0; match && tokens[j]; j++) {
554 match = g_regex_match(tokens[j]->regex, input, 0, NULL);
555 match ^= tokens[j]->invert;
568 GError *error = NULL;
569 g_spawn_async_with_pipes(NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
570 NULL, NULL, &fd, NULL, &error);
573 char *msg = g_strdup_printf(
"Failed to execute: '%s'\nError: '%s'", cmd,
590 int fd = g_open(
pidfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
592 g_warning(
"Failed to create pid file: '%s'.",
pidfile);
596 int flags = fcntl(fd, F_GETFD, NULL);
598 if (fcntl(fd, F_SETFD,
flags, NULL) < 0) {
599 g_warning(
"Failed to set CLOEXEC on pidfile.");
604 int retv = flock(fd, LOCK_EX | LOCK_NB);
606 g_warning(
"Failed to set lock on pidfile: Rofi already running?");
607 g_warning(
"Got error: %d %s", retv, g_strerror(errno));
612 ssize_t l = read(fd, &(buffer[0]), 63);
615 pid_t pid = g_ascii_strtoll(buffer, NULL, 0);
618 retv = flock(fd, LOCK_EX | LOCK_NB);
632 if (ftruncate(fd, (off_t)0) == 0) {
635 int length = snprintf(buffer, 64,
"%i", getpid());
638 l += write(fd, &buffer[l], length - l);
647 g_warning(
"Failed to close pidfile: '%s'", g_strerror(errno));
653 const char *fam = pango_font_description_get_family(pfd);
654 int size = pango_font_description_get_size(pfd);
655 if (fam == NULL || size == 0) {
656 g_debug(
"Pango failed to parse font: '%s'", font);
657 g_debug(
"Got family: <b>%s</b> at size: <b>%d</b>", fam ? fam :
"{unknown}",
672 int found_error = FALSE;
674 g_string_new(
"<big><b>The configuration failed to validate:</b></big>\n");
676 if (
config.sorting_method) {
677 if (g_strcmp0(
config.sorting_method,
"normal") == 0) {
679 }
else if (g_strcmp0(
config.sorting_method,
"levenshtein") == 0) {
681 }
else if (g_strcmp0(
config.sorting_method,
"fzf") == 0) {
684 g_string_append_printf(
686 "\t<b>config.sorting_method</b>=%s is not a valid sorting "
687 "strategy.\nValid options are: normal or fzf.\n",
694 char **strv = g_strsplit(
config.matching,
",", 0);
696 int matching_method_index = 0;
697 for (
char **str = strv; *str && matching_method_index <
MM_NUM_MATCHERS;
699 gboolean found = FALSE;
705 matching_method_index++;
709 g_string_append_printf(msg,
710 "\t<b>config.matching</b> = %s to many "
711 "matching options enabled.\n",
718 g_string_append_printf(msg,
719 "\t<b>config.matching</b>=%s is not a valid "
720 "matching strategy.\nValid options are: glob, "
721 "regex, fuzzy, prefix or normal.\n",
731 if (
config.element_height < 1) {
732 g_string_append_printf(msg,
733 "\t<b>config.element_height</b>=%d is invalid. An "
734 "element needs to be at least 1 line high.\n",
736 config.element_height = 1;
740 g_string_append_printf(msg,
741 "\t<b>config.location</b>=%d is invalid. Value "
742 "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);
767 if (g_strcmp0(
config.monitor,
"-3") == 0) {
773 g_string_append(msg,
"Please update your configuration.");
778 g_string_free(msg, TRUE);
783 char **str = g_strsplit(input, G_DIR_SEPARATOR_S, -1);
784 for (
unsigned int i = 0; str && str[i]; i++) {
786 if (str[i][0] ==
'~' && str[i][1] ==
'\0') {
788 str[i] = g_strdup(g_get_home_dir());
791 else if (str[i][0] ==
'~') {
792 struct passwd *p = getpwnam(&(str[i][1]));
795 str[i] = g_strdup(p->pw_dir);
799 if (input[0] == G_DIR_SEPARATOR) {
800 str[i] = g_strdup_printf(
"%s%s", G_DIR_SEPARATOR_S, s);
805 char *retv = g_build_filenamev(str);
811#define MIN3(a, b, c) \
812 ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
814unsigned int levenshtein(
const char *needle,
const glong needlelen,
815 const char *haystack,
const glong haystacklen,
816 int case_sensitive) {
817 if (needlelen == G_MAXLONG) {
821 unsigned int column[needlelen + 1];
822 for (glong y = 0; y < needlelen; y++) {
827 column[needlelen] = needlelen;
828 for (glong x = 1; x <= haystacklen; x++) {
829 const char *needles = needle;
831 gunichar haystackc = g_utf8_get_char(haystack);
832 if (!case_sensitive) {
833 haystackc = g_unichar_tolower(haystackc);
835 for (glong y = 1, lastdiag = x - 1; y <= needlelen; y++) {
836 gunichar needlec = g_utf8_get_char(needles);
837 if (!case_sensitive) {
838 needlec = g_unichar_tolower(needlec);
840 unsigned int olddiag = column[y];
841 column[y] =
MIN3(column[y] + 1, column[y - 1] + 1,
842 lastdiag + (needlec == haystackc ? 0 : 1));
844 needles = g_utf8_next_char(needles);
846 haystack = g_utf8_next_char(haystack);
848 return column[needlelen];
853 return g_convert_with_fallback(input, length,
"UTF-8",
"latin1",
"\uFFFD",
854 NULL, &slength, NULL);
864 if (g_utf8_validate(data, length, &end)) {
865 return g_memdup2(data, length + 1);
867 string = g_string_sized_new(length + 16);
871 g_string_append_len(
string, data, end - data);
873 g_string_append(
string,
"\uFFFD");
874 length -= (end - data) + 1;
876 }
while (!g_utf8_validate(data, length, &end));
879 g_string_append_len(
string, data, length);
882 return g_string_free(
string, FALSE);
890#define FUZZY_SCORER_MAX_LENGTH 256
892#define MIN_SCORE (INT_MIN / 2)
894#define LEADING_GAP_SCORE -4
898#define WORD_START_SCORE 50
900#define NON_WORD_SCORE 40
902#define CAMEL_SCORE (WORD_START_SCORE + GAP_SCORE - 1)
904#define CONSECUTIVE_SCORE (WORD_START_SCORE + GAP_SCORE)
906#define PATTERN_NON_START_MULTIPLIER 1
908#define PATTERN_START_MULTIPLIER 2
930 if (g_unichar_islower(c)) {
933 if (g_unichar_isupper(c)) {
936 if (g_unichar_isdigit(c)) {
964 glong slen,
int case_sensitive) {
970 gboolean pfirst = TRUE;
972 gboolean pstart = TRUE;
974 int *score = g_malloc_n(slen,
sizeof(
int));
976 int *dp = g_malloc_n(slen,
sizeof(
int));
979 int uleft = 0, ulefts = 0, left, lefts;
980 const gchar *pit = pattern, *sit;
982 for (si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char(sit)) {
988 for (pi = 0; pi < plen; pi++, pit = g_utf8_next_char(pit)) {
989 gunichar pc = g_utf8_get_char(pit), sc;
990 if (g_unichar_isspace(pc)) {
995 for (si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char(sit)) {
998 sc = g_utf8_get_char(sit);
999 if (case_sensitive ? pc == sc
1000 : g_unichar_tolower(pc) == g_unichar_tolower(sc)) {
1011 pfirst = pstart = FALSE;
1014 for (si = 0; si < slen; si++) {
1034 char *na = g_utf8_normalize(a, -1, G_NORMALIZE_ALL_COMPOSE);
1035 char *nb = g_utf8_normalize(b, -1, G_NORMALIZE_ALL_COMPOSE);
1036 *g_utf8_offset_to_pointer(na, n) =
'\0';
1037 *g_utf8_offset_to_pointer(nb, n) =
'\0';
1038 int r = g_utf8_collate(na, nb);
1045 const char *error_cmd,
1047 gboolean retv = TRUE;
1048 GError *error = NULL;
1050 GSpawnChildSetupFunc child_setup = NULL;
1051 gpointer user_data = NULL;
1055 g_spawn_async(wd, args, NULL, G_SPAWN_SEARCH_PATH, child_setup, user_data,
1057 if (error != NULL) {
1058 char *msg = g_strdup_printf(
"Failed to execute: '%s%s'\nError: '%s'",
1059 error_precmd, error_cmd, error->message);
1063 g_error_free(error);
1073 gboolean run_in_term,
1090 if (context != NULL) {
1091 if (context->
name == NULL) {
1092 context->
name = args[0];
1094 if (context->
binary == NULL) {
1095 context->
binary = args[0];
1098 gsize l = strlen(
"Launching '' via rofi") + strlen(cmd) + 1;
1099 gchar *description = g_newa(gchar, l);
1101 g_snprintf(description, l,
"Launching '%s' via rofi", cmd);
1104 if (context->
command == NULL) {
1113 const char *parent_file) {
1116 if (g_path_is_absolute(filename)) {
1117 g_debug(
"Opening theme, path is absolute: %s", filename);
1118 if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
1119 return g_strdup(filename);
1121 g_debug(
"Opening theme, path is absolute but does not exists: %s",
1124 if (parent_file != NULL) {
1126 char *basedir = g_path_get_dirname(parent_file);
1127 char *path = g_build_filename(basedir, filename, NULL);
1129 g_debug(
"Opening theme, check in dir where file is included: %s", path);
1130 if (g_file_test(path, G_FILE_TEST_EXISTS)) {
1133 g_debug(
"Opening theme, file does not exists in dir where file is "
1139 const char *cpath = g_get_user_config_dir();
1141 char *themep = g_build_filename(cpath,
"rofi",
"themes", filename, NULL);
1142 g_debug(
"Opening theme, testing: %s", themep);
1143 if (themep && g_file_test(themep, G_FILE_TEST_EXISTS)) {
1150 char *themep = g_build_filename(cpath,
"rofi", filename, NULL);
1151 g_debug(
"Opening theme, testing: %s", themep);
1152 if (g_file_test(themep, G_FILE_TEST_EXISTS)) {
1157 const char *datadir = g_get_user_data_dir();
1160 g_build_filename(datadir,
"rofi",
"themes", filename, NULL);
1162 g_debug(
"Opening theme, testing: %s", theme_path);
1163 if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
1170 const gchar *
const *system_data_dirs = g_get_system_data_dirs();
1171 if (system_data_dirs) {
1172 for (uint_fast32_t i = 0; system_data_dirs[i] != NULL; i++) {
1173 const char *
const sdatadir = system_data_dirs[i];
1174 g_debug(
"Opening theme directory: %s", sdatadir);
1176 g_build_filename(sdatadir,
"rofi",
"themes", filename, NULL);
1178 g_debug(
"Opening theme, testing: %s", theme_path);
1179 if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
1187 char *theme_path = g_build_filename(THEME_DIR, filename, NULL);
1189 g_debug(
"Opening theme, testing: %s", theme_path);
1190 if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
1199 const char *parent_file) {
1202 g_debug(
"Opening theme, testing: %s\n", filename);
1203 if (g_path_is_absolute(filename)) {
1204 g_debug(
"Opening theme, path is absolute: %s", filename);
1205 if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
1209 gboolean ext_found = FALSE;
1210 for (
const char **i = ext; *i != NULL; i++) {
1211 if (g_str_has_suffix(file, *i)) {
1225 g_assert_nonnull(ext[0]);
1227 char *temp = filename;
1228 for (
const char **i = ext; *i != NULL; i++) {
1229 filename = g_strconcat(temp, *i, NULL);
1245 while (input != NULL && isblank(*input)) {
1249 if (input == NULL) {
1253 const char *sep[] = {
"-",
":"};
1254 int pythonic = (strchr(input,
':') || input[0] ==
'-') ? 1 : 0;
1257 for (
char *token = strsep(&input, sep[pythonic]); token != NULL;
1258 token = strsep(&input, sep[pythonic])) {
1260 item->
start = item->
stop = (int)strtol(token, NULL, 10);
1265 if (token[0] ==
'\0') {
1270 item->
stop = (int)strtol(token, NULL, 10);
1279 if (input == NULL) {
1282 const char *
const sep =
",";
1283 for (
char *token = strtok_r(input, sep, &endp); token != NULL;
1284 token = strtok_r(NULL, sep, &endp)) {
1289 if (
parse_pair(token, &((*list)[*length]))) {
1296 int case_sensitive =
config.case_sensitive;
1300 case_sensitive = FALSE;
1302 if (g_utf8_validate(input, -1, &end)) {
1303 for (
const char *c = (input); !case_sensitive && c != NULL && *c;
1304 c = g_utf8_next_char(c)) {
1305 gunichar uc = g_utf8_get_char(c);
1306 if (g_unichar_isupper(uc)) {
1307 case_sensitive = TRUE;
1313 return case_sensitive;
1317 int selected_line,
const char *filter) {
1318 for (
int i = 0; format && format[i]; i++) {
1319 if (format[i] ==
'i') {
1320 fprintf(stdout,
"%d", selected_line);
1321 }
else if (format[i] ==
'd') {
1322 fprintf(stdout,
"%d", (selected_line + 1));
1323 }
else if (format[i] ==
's') {
1324 fputs(
string, stdout);
1325 }
else if (format[i] ==
'p') {
1327 pango_parse_markup(
string, -1, 0, NULL, &esc, NULL, NULL);
1332 fputs(
"invalid string", stdout);
1334 }
else if (format[i] ==
'q') {
1335 char *quote = g_shell_quote(
string);
1336 fputs(quote, stdout);
1338 }
else if (format[i] ==
'f') {
1340 fputs(filter, stdout);
1342 }
else if (format[i] ==
'F') {
1344 char *quote = g_shell_quote(filter);
1345 fputs(quote, stdout);
1349 fputc(format[i], stdout);
1352 fputc(
'\n', stdout);
1360 int num_match = g_match_info_get_match_count(info);
1362 if (num_match == 5) {
1363 match = g_match_info_fetch(info, 4);
1364 if (match != NULL) {
1366 gchar *r = g_hash_table_lookup((GHashTable *)data, match);
1369 g_string_append(res, r);
1376 else if (num_match == 4) {
1377 match = g_match_info_fetch(info, 2);
1378 if (match != NULL) {
1380 gchar *r = g_hash_table_lookup((GHashTable *)data, match);
1383 gchar *prefix = g_match_info_fetch(info, 1);
1384 g_string_append(res, prefix);
1387 g_string_append(res, r);
1389 gchar *post = g_match_info_fetch(info, 3);
1390 g_string_append(res, post);
1404 h = g_hash_table_new(g_str_hash, g_str_equal);
1406 va_start(ap,
string);
1409 char *key = va_arg(ap,
char *);
1410 if (key == (
char *)0) {
1413 char *value = va_arg(ap,
char *);
1414 g_hash_table_insert(h, key, value);
1419 g_hash_table_destroy(h);
1438 GError *error = NULL;
1442 GRegex *reg = g_regex_new(
"\\[(.*)({[-\\w]+})(.*)\\]|({[\\w-]+})",
1443 G_REGEX_UNGREEDY, 0, &error);
1444 if (error == NULL) {
1446 g_regex_replace_eval(reg,
string, -1, 0, 0,
helper_eval_cb2, h, &error);
1451 if (error != NULL) {
1452 char *msg = g_strdup_printf(
"Failed to parse: '%s'\nError: '%s'",
string,
1457 g_error_free(error);
int monitor_active(workarea *mon)
void display_startup_notification(RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data)
struct _workarea workarea
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