rofi
1.5.4
|
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <pwd.h>
#include <ctype.h>
#include <pango/pango.h>
#include <pango/pango-fontmap.h>
#include <pango/pangocairo.h>
#include <librsvg/rsvg.h>
#include "display.h"
#include "xcb.h"
#include "helper.h"
#include "helper-theme.h"
#include "settings.h"
#include "rofi.h"
#include "view.h"
Go to the source code of this file.
Macros | |
#define | G_LOG_DOMAIN "Helper" |
#define | MIN3(a, b, c) ( ( a ) < ( b ) ? ( ( a ) < ( c ) ? ( a ) : ( c ) ) : ( ( b ) < ( c ) ? ( b ) : ( c ) ) ) |
#define | FUZZY_SCORER_MAX_LENGTH 256 |
#define | MIN_SCORE ( INT_MIN / 2 ) |
#define | LEADING_GAP_SCORE -4 |
#define | GAP_SCORE -5 |
#define | WORD_START_SCORE 50 |
#define | NON_WORD_SCORE 40 |
#define | CAMEL_SCORE ( WORD_START_SCORE + GAP_SCORE - 1 ) |
#define | CONSECUTIVE_SCORE ( WORD_START_SCORE + GAP_SCORE ) |
#define | PATTERN_NON_START_MULTIPLIER 1 |
#define | PATTERN_START_MULTIPLIER 2 |
Enumerations | |
enum | CharClass { LOWER, UPPER, DIGIT, NON_WORD } |
Functions | |
char * | helper_string_replace_if_exists_v (char *string, GHashTable *h) |
void | cmd_set_arguments (int argc, char **argv) |
int | helper_parse_setup (char *string, char ***output, int *length,...) |
void | helper_tokenize_free (rofi_int_matcher **tokens) |
static gchar * | glob_to_regex (const char *input) |
static gchar * | fuzzy_to_regex (const char *input) |
static GRegex * | R (const char *s, int case_sensitive) |
static rofi_int_matcher * | create_regex (const char *input, int case_sensitive) |
rofi_int_matcher ** | helper_tokenize (const char *input, int case_sensitive) |
int | find_arg (const char *const key) |
int | find_arg_str (const char *const key, char **val) |
const char ** | find_arg_strv (const char *const key) |
int | find_arg_int (const char *const key, int *val) |
int | find_arg_uint (const char *const key, unsigned int *val) |
char | helper_parse_char (const char *arg) |
int | find_arg_char (const char *const key, char *val) |
PangoAttrList * | helper_token_match_get_pango_attr (RofiHighlightColorStyle th, rofi_int_matcher **tokens, const char *input, PangoAttrList *retv) |
int | helper_token_match (rofi_int_matcher *const *tokens, const char *input) |
int | execute_generator (const char *cmd) |
int | create_pid_file (const char *pidfile) |
void | remove_pid_file (int fd) |
gboolean | helper_validate_font (PangoFontDescription *pfd, const char *font) |
int | config_sanity_check (void) |
char * | rofi_expand_path (const char *input) |
unsigned int | levenshtein (const char *needle, const glong needlelen, const char *haystack, const glong haystacklen) |
char * | rofi_latin_to_utf8_strdup (const char *input, gssize length) |
gchar * | rofi_escape_markup (gchar *text) |
char * | rofi_force_utf8 (const gchar *data, ssize_t length) |
static enum CharClass | rofi_scorer_get_character_class (gunichar c) |
static int | rofi_scorer_get_score_for (enum CharClass prev, enum CharClass curr) |
int | rofi_scorer_fuzzy_evaluate (const char *pattern, glong plen, const char *str, glong slen) |
int | utf8_strncmp (const char *a, const char *b, size_t n) |
gboolean | helper_execute (const char *wd, char **args, const char *error_precmd, const char *error_cmd, RofiHelperExecuteContext *context) |
gboolean | helper_execute_command (const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context) |
char * | helper_get_theme_path (const char *file) |
cairo_surface_t * | cairo_image_surface_create_from_svg (const gchar *file, int height) |
static void | parse_pair (char *input, rofi_range_pair *item) |
void | parse_ranges (char *input, rofi_range_pair **list, unsigned int *length) |
void | rofi_output_formatted_line (const char *format, const char *string, int selected_line, const char *filter) |
static gboolean | helper_eval_cb2 (const GMatchInfo *info, GString *res, gpointer data) |
char * | helper_string_replace_if_exists (char *string,...) |
Variables | |
const char *const | monitor_position_entries [] |
static int | stored_argc = 0 |
static char ** | stored_argv = NULL |
#define CAMEL_SCORE ( WORD_START_SCORE + GAP_SCORE - 1 ) |
#define CONSECUTIVE_SCORE ( WORD_START_SCORE + GAP_SCORE ) |
#define FUZZY_SCORER_MAX_LENGTH 256 |
#define G_LOG_DOMAIN "Helper" |
#define MIN3 | ( | a, | |
b, | |||
c | |||
) | ( ( a ) < ( b ) ? ( ( a ) < ( c ) ? ( a ) : ( c ) ) : ( ( b ) < ( c ) ? ( b ) : ( c ) ) ) |
#define PATTERN_NON_START_MULTIPLIER 1 |
enum CharClass |
|
static |
Definition at line 190 of file helper.c.
References config, fuzzy_to_regex(), glob_to_regex(), rofi_int_matcher_t::invert, Settings::matching_method, Settings::matching_negate_char, MM_FUZZY, MM_GLOB, MM_REGEX, R(), and rofi_int_matcher_t::regex.
Referenced by helper_tokenize().
|
static |
Definition at line 153 of file helper.c.
Referenced by create_regex().
|
static |
Definition at line 136 of file helper.c.
Referenced by create_regex().
|
static |
Definition at line 1219 of file helper.c.
Referenced by helper_string_replace_if_exists_v().
char* helper_get_theme_path | ( | const char * | file | ) |
file | File name passed to option. |
Definition at line 1023 of file helper.c.
References rofi_expand_path().
char * helper_string_replace_if_exists_v | ( | char * | string, |
GHashTable * | h | ||
) |
string | The string with elements to be replaced |
h | Hash table with set of {key}, value that will be replaced, terminated by a NULL |
Items {key} are replaced by the value if '{key}' is passed as key/value pair, otherwise removed from string. If the {key} is in between [] all the text between [] are removed if {key} is not found. Otherwise key is replaced and [ & ] removed.
This allows for optional replacement, f.e. '{ssh-client} [-t {title}] -e "{cmd}"' the '-t {title}' is only there if {title} is set.
Definition at line 1299 of file helper.c.
References helper_eval_cb2(), and rofi_view_error_dialog().
Referenced by helper_parse_setup(), and helper_string_replace_if_exists().
|
static |
Definition at line 1118 of file helper.c.
References rofi_range_pair::start, and rofi_range_pair::stop.
Referenced by parse_ranges().
|
inlinestatic |
Definition at line 185 of file helper.c.
Referenced by create_regex().
|
static |
c | The character to determine class of |
Definition at line 742 of file helper.c.
Referenced by rofi_scorer_fuzzy_evaluate().
prev | The previous character. |
curr | The current character |
Scrore the transition.
Definition at line 838 of file helper.c.
References CAMEL_SCORE, DIGIT, LOWER, NON_WORD, NON_WORD_SCORE, UPPER, and WORD_START_SCORE.
Referenced by rofi_scorer_fuzzy_evaluate().
int utf8_strncmp | ( | const char * | a, |
const char * | b, | ||
size_t | n | ||
) |
a | UTF-8 string to compare |
b | UTF-8 string to compare |
n | Maximum number of characters to compare |
Compares the G_NORMALIZE_ALL_COMPOSE
forms of the two strings.
n
characters (not bytes) of a
are found, respectively, to be less than, to match, or be greater than the first n
characters (not bytes) of b
. Definition at line 952 of file helper.c.
Referenced by combi_mode_result(), and combi_preprocess_input().
const char* const monitor_position_entries[] |
Textual description of positioning rofi.
Definition at line 62 of file helper.c.
Referenced by config_sanity_check().
|
static |
copy of the argc for use in commandline argument parser.
Definition at line 70 of file helper.c.
Referenced by cmd_set_arguments(), find_arg(), find_arg_char(), find_arg_int(), find_arg_str(), find_arg_strv(), and find_arg_uint().
|
static |
copy of the argv pointer for use in the commandline argument parser
Definition at line 72 of file helper.c.
Referenced by cmd_set_arguments(), find_arg(), find_arg_char(), find_arg_int(), find_arg_str(), find_arg_strv(), and find_arg_uint().