summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-08-25 08:43:40 +0200
committerDave Davenport <qball@gmpclient.org>2016-08-25 21:17:58 +0200
commit20e55e1e4e7a084e2e86c16e5b3f0497a14773a4 (patch)
treee3a45cbbbf93135bcafbdced2878bac0282d2fe6
parenta657f81145465df1d8a75bedb1b56a0e99d541e0 (diff)
Add fuzzy matching, make a -matching option.
* -matching *method* option instead of -regex, -glob, -fuzzy. * Re-add fuzzy matching pattern. * When there are substrings in regex, only highlight those matches. Fixes: #447
-rw-r--r--config/config.c8
-rw-r--r--doc/rofi-manpage.markdown18
-rw-r--r--doc/rofi.130
-rw-r--r--doc/test_xr.txt6
-rw-r--r--include/helper.h1
-rw-r--r--include/settings.h17
-rw-r--r--include/textbox.h20
-rw-r--r--source/dialogs/ssh.c2
-rw-r--r--source/helper.c91
-rw-r--r--source/rofi.c36
-rw-r--r--source/xrmoptions.c106
-rwxr-xr-xtest/run_glob_test.sh2
-rwxr-xr-xtest/run_regex_test.sh2
13 files changed, 209 insertions, 130 deletions
diff --git a/config/config.c b/config/config.c
index 1a9da3b0..b7b76f31 100644
--- a/config/config.c
+++ b/config/config.c
@@ -107,10 +107,10 @@ Settings config = {
/** Parse ~/.ssh/known_hosts file in ssh view. */
.parse_known_hosts = TRUE,
/** Modi to combine into one view. */
- .combi_modi = "window,run",
- .glob = FALSE,
- .tokenize = TRUE,
- .regex = FALSE,
+ .combi_modi = "window,run",
+ .tokenize = TRUE,
+ .matching = "normal",
+ .matching_method = MM_NORMAL,
/** Monitor */
.monitor = "-5",
/** set line margin */
diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown
index d668b25e..e203d43b 100644
--- a/doc/rofi-manpage.markdown
+++ b/doc/rofi-manpage.markdown
@@ -45,8 +45,7 @@
[ -combi-modi *mode1,mode2* ]
[ -normal-window ]
[ -fake-transparency ]
-[ -glob ]
-[ -regex ]
+[ -matching *method* ]
[ -tokenize ]
[ -threads *num* ]
[ -config *filename* ]
@@ -275,14 +274,19 @@ Hide the scrollbar.
Set the scrollbar width.
-`-glob`
+`-matching` *method*
-Use glob style matching
-*Warning this option might be slow on large lists*
+Specify the matching algorithm used.
+Current the following methods are supported.
-`-regex`
+* **normal**: Match the int string.
+* **regex**: Match a regex input.
+* **glob**: Match a glob pattern.
+* **fuzzy**: Do a fuzzy match.
-Use regex matching
+ Default: normal
+
+ Note:, glob matching might be slow for larger lists.
`-tokenize`
diff --git a/doc/rofi.1 b/doc/rofi.1
index 5c387a41..38ed7579 100644
--- a/doc/rofi.1
+++ b/doc/rofi.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "ROFI\-MANPAGE" "" "2016-08-22" "" ""
+.TH "ROFI\-MANPAGE" "" "2016-08-25" "" ""
.
.SH "NAME"
\fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement
.
.SH "SYNOPSIS"
-\fBrofi\fR [ \-width \fIpct_scr\fR ] [ \-lines \fIlines\fR ] [ \-columns \fIcolumns\fR ] [ \-font \fIpangofont\fR ] [ \-terminal \fIterminal\fR ] [ \-location \fIposition\fR ] [ \-fixed\-num\-lines ] [ \-padding \fIpadding\fR ] [ \-opacity \fIopacity%\fR ] [ \-display \fIdisplay\fR ] [ \-bw \fIwidth\fR ] [ \-dmenu [ \-p \fIprompt\fR ] [ \-sep \fIseparator\fR ] [ \-l \fIselected line\fR ] [ \-mesg ] [ \-select ] [ \-input \fIinput\fR ] ] [ \-filter \fIfilter\fR ] [ \-ssh\-client \fIclient\fR ] [ \-ssh\-command \fIcommand\fR ] [ \-window\-command \fIcommand\fR ] [ \-disable\-history ] [ \-levenshtein\-sort ] [ \-case\-sensitive ] [ \-cycle ] [ \-show \fImode\fR ] [ \-modi \fImode1,mode2\fR ] [ \-eh \fIelement height\fR ] [ \-lazy\-filter\-limit \fIlimit\fR ] [ \-e \fImessage\fR] [ \-a \fIrow\fR ] [ \-u \fIrow\fR ] [ \-pid \fIpath\fR ] [ \-version ] [ \-help ] [ \-dump\-xresources ] [ \-dump\-xresources\-theme ] [ \-auto\-select ] [ \-parse\-hosts ] [ \-no\-parse\-known\-hosts ] [ \-combi\-modi \fImode1,mode2\fR ] [ \-normal\-window ] [ \-fake\-transparency ] [ \-glob ] [ \-regex ] [ \-tokenize ] [ \-threads \fInum\fR ] [ \-config \fIfilename\fR ]
+\fBrofi\fR [ \-width \fIpct_scr\fR ] [ \-lines \fIlines\fR ] [ \-columns \fIcolumns\fR ] [ \-font \fIpangofont\fR ] [ \-terminal \fIterminal\fR ] [ \-location \fIposition\fR ] [ \-fixed\-num\-lines ] [ \-padding \fIpadding\fR ] [ \-opacity \fIopacity%\fR ] [ \-display \fIdisplay\fR ] [ \-bw \fIwidth\fR ] [ \-dmenu [ \-p \fIprompt\fR ] [ \-sep \fIseparator\fR ] [ \-l \fIselected line\fR ] [ \-mesg ] [ \-select ] [ \-input \fIinput\fR ] ] [ \-filter \fIfilter\fR ] [ \-ssh\-client \fIclient\fR ] [ \-ssh\-command \fIcommand\fR ] [ \-window\-command \fIcommand\fR ] [ \-disable\-history ] [ \-levenshtein\-sort ] [ \-case\-sensitive ] [ \-cycle ] [ \-show \fImode\fR ] [ \-modi \fImode1,mode2\fR ] [ \-eh \fIelement height\fR ] [ \-lazy\-filter\-limit \fIlimit\fR ] [ \-e \fImessage\fR] [ \-a \fIrow\fR ] [ \-u \fIrow\fR ] [ \-pid \fIpath\fR ] [ \-version ] [ \-help ] [ \-dump\-xresources ] [ \-dump\-xresources\-theme ] [ \-auto\-select ] [ \-parse\-hosts ] [ \-no\-parse\-known\-hosts ] [ \-combi\-modi \fImode1,mode2\fR ] [ \-normal\-window ] [ \-fake\-transparency ] [ \-matching \fImethod\fR ] [ \-tokenize ] [ \-threads \fInum\fR ] [ \-config \fIfilename\fR ]
.
.SH "DESCRIPTION"
\fBrofi\fR is an X11 popup window switcher, run dialog, dmenu replacement and more\. It focuses on being fast to use and have minimal distraction\. It supports keyboard and mouse navigation, type to filter, tokenized search and more\.
@@ -444,16 +444,30 @@ Hide the scrollbar\.
Set the scrollbar width\.
.
.P
-\fB\-glob\fR
+\fB\-matching\fR \fImethod\fR
.
.P
-Use glob style matching \fIWarning this option might be slow on large lists\fR
+Specify the matching algorithm used\. Current the following methods are supported\.
.
-.P
-\fB\-regex\fR
+.IP "\(bu" 4
+\fBnormal\fR: Match the int string\.
.
-.P
-Use regex matching
+.IP "\(bu" 4
+\fBregex\fR: Match a regex input\.
+.
+.IP "\(bu" 4
+\fBglob\fR: Match a glob pattern\.
+.
+.IP "\(bu" 4
+\fBfuzzy\fR: Do a fuzzy match\.
+.
+.IP
+Default: normal
+.
+.IP
+Note:, glob matching might be slow for larger lists\.
+.
+.IP "" 0
.
.P
\fB\-tokenize\fR
diff --git a/doc/test_xr.txt b/doc/test_xr.txt
index e1570290..2f5664e9 100644
--- a/doc/test_xr.txt
+++ b/doc/test_xr.txt
@@ -64,10 +64,8 @@ rofi.parse-hosts: false
rofi.parse-known-hosts: true
! "Set the modi to combine in combi mode" Set from: File
rofi.combi-modi: window,drun,run,ssh
-! "Use glob matching" Set from: File
-rofi.glob: false
-! "Use regex matching" Set from: File
-rofi.regex: false
+! "Set the matching algorithm. (normal, regex, glob, fuzzy)" Set from: Default
+! rofi.matching: normal
! "Tokenize input string" Set from: File
rofi.tokenize: true
! "Monitor id to show on" Set from: File
diff --git a/include/helper.h b/include/helper.h
index fafce9ac..869b6a95 100644
--- a/include/helper.h
+++ b/include/helper.h
@@ -85,7 +85,6 @@ int find_arg_str ( const char * const key, char** val );
*/
int find_arg ( const char * const key );
-
/**
* @param tokens List of (input) tokens to match.
* @param input The entry to match against.
diff --git a/include/settings.h b/include/settings.h
index 39b60868..e61c5276 100644
--- a/include/settings.h
+++ b/include/settings.h
@@ -2,6 +2,19 @@
#define ROFI_SETTINGS_H
/**
+ * Enumeration indicating the matching method to use.
+ *
+ * @ingroup CONFIGURATION
+ */
+typedef enum
+{
+ MM_NORMAL = 0,
+ MM_REGEX = 1,
+ MM_GLOB = 2,
+ MM_FUZZY = 3
+} MatchingMethod;
+
+/**
* Enumeration indicating location or gravity of window.
*
* \verbatim WL_NORTH_WEST WL_NORTH WL_NORTH_EAST \endverbatim
@@ -105,9 +118,9 @@ typedef struct
unsigned int parse_known_hosts;
/** Combi Modes */
char *combi_modi;
- unsigned int glob;
+ char *matching;
+ MatchingMethod matching_method;
unsigned int tokenize;
- unsigned int regex;
/** Monitors */
char *monitor;
/** Line margin */
diff --git a/include/textbox.h b/include/textbox.h
index 6e69b18c..936593d1 100644
--- a/include/textbox.h
+++ b/include/textbox.h
@@ -39,16 +39,16 @@ typedef struct
typedef enum
{
- TB_AUTOHEIGHT = 1 << 0,
- TB_AUTOWIDTH = 1 << 1,
- TB_LEFT = 1 << 16,
- TB_RIGHT = 1 << 17,
- TB_CENTER = 1 << 18,
- TB_EDITABLE = 1 << 19,
- TB_MARKUP = 1 << 20,
- TB_WRAP = 1 << 21,
- TB_PASSWORD = 1 << 22,
- TB_INDICATOR = 1 << 23,
+ TB_AUTOHEIGHT = 1 << 0,
+ TB_AUTOWIDTH = 1 << 1,
+ TB_LEFT = 1 << 16,
+ TB_RIGHT = 1 << 17,
+ TB_CENTER = 1 << 18,
+ TB_EDITABLE = 1 << 19,
+ TB_MARKUP = 1 << 20,
+ TB_WRAP = 1 << 21,
+ TB_PASSWORD = 1 << 22,
+ TB_INDICATOR = 1 << 23,
} TextboxFlags;
typedef enum
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c
index f11ba3a1..397893dc 100644
--- a/source/dialogs/ssh.c
+++ b/source/dialogs/ssh.c
@@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
// Reading one line per time.
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
// Evaluate one line.
- unsigned int index = 0, ti = 0;
+ unsigned int index = 0, ti = 0;
char *token = buffer;
// Tokenize it.
diff --git a/source/helper.c b/source/helper.c
index 6908f1ef..9e420c91 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -168,28 +168,58 @@ static gchar *glob_to_regex ( const char *input )
}
return r;
}
+static gchar *fuzzy_to_regex ( const char * input )
+{
+ GString *str = g_string_new ( "" );
+ gchar *r = g_regex_escape_string ( input, -1 );
+ gchar *iter;
+ int first = 1;
+ for ( iter = r; iter && *iter != '\0'; iter = g_utf8_next_char ( iter ) ) {
+ if ( first ) {
+ g_string_append ( str, "(" );
+ }
+ else {
+ g_string_append ( str, ".*(" );
+ }
+ g_string_append_unichar ( str, g_utf8_get_char ( iter ) );
+ g_string_append ( str, ")" );
+ first = 0;
+ }
+ g_free ( r );
+ char *retv = str->str;
+ g_string_free ( str, FALSE );
+ return retv;
+}
static GRegex * create_regex ( const char *input, int case_sensitive )
{
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
GRegex * retv = NULL;
- if ( config.glob ) {
- gchar *r = glob_to_regex ( input );
+ gchar *r;
+ switch ( config.matching_method )
+ {
+ case MM_GLOB:
+ r = glob_to_regex ( input );
retv = R ( r );
g_free ( r );
- }
- else if ( config.regex ) {
+ break;
+ case MM_REGEX:
retv = R ( input );
if ( retv == NULL ) {
- gchar *r = g_regex_escape_string ( input, -1 );
+ r = g_regex_escape_string ( input, -1 );
retv = R ( r );
g_free ( r );
}
- }
- else{
- // TODO; regex should be default?
- gchar *r = g_regex_escape_string ( input, -1 );
+ break;
+ case MM_FUZZY:
+ r = fuzzy_to_regex ( input );
+ retv = R ( r );
+ g_free ( r );
+ break;
+ default:
+ r = g_regex_escape_string ( input, -1 );
retv = R ( r );
g_free ( r );
+ break;
}
return retv;
}
@@ -204,7 +234,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
}
char *saveptr = NULL, *token;
- GRegex **retv = NULL;
+ GRegex **retv = NULL;
if ( !config.tokenize ) {
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
@@ -346,14 +376,17 @@ PangoAttrList *token_match_get_pango_attr ( GRegex **tokens, const char *input,
GMatchInfo *gmi = NULL;
g_regex_match ( (GRegex *) tokens[j], input, G_REGEX_MATCH_PARTIAL, &gmi );
while ( g_match_info_matches ( gmi ) ) {
- int start, end;
- g_match_info_fetch_pos ( gmi, 0, &start, &end );
- PangoAttribute *pa = pango_attr_underline_new ( PANGO_UNDERLINE_SINGLE );
- PangoAttribute *pa2 = pango_attr_weight_new ( PANGO_WEIGHT_BOLD );
- pa2->start_index = pa->start_index = start;
- pa2->end_index = pa->end_index = end;
- pango_attr_list_insert ( retv, pa );
- pango_attr_list_insert ( retv, pa2 );
+ int count = g_match_info_get_match_count ( gmi );
+ for ( int index = ( count > 1 ) ? 1 : 0; index < count; index++ ) {
+ int start, end;
+ g_match_info_fetch_pos ( gmi, index, &start, &end );
+ PangoAttribute *pa = pango_attr_underline_new ( PANGO_UNDERLINE_SINGLE );
+ PangoAttribute *pa2 = pango_attr_weight_new ( PANGO_WEIGHT_BOLD );
+ pa2->start_index = pa->start_index = start;
+ pa2->end_index = pa->end_index = end;
+ pango_attr_list_insert ( retv, pa );
+ pango_attr_list_insert ( retv, pa2 );
+ }
g_match_info_next ( gmi, NULL );
}
g_match_info_free ( gmi );
@@ -362,7 +395,6 @@ PangoAttrList *token_match_get_pango_attr ( GRegex **tokens, const char *input,
return retv;
}
-
int token_match ( GRegex * const *tokens, const char *input )
{
int match = 1;
@@ -458,6 +490,27 @@ int config_sanity_check ( void )
int found_error = FALSE;
GString *msg = g_string_new (
"<big><b>The configuration failed to validate:</b></big>\n" );
+
+ if ( config.matching ) {
+ if ( g_strcmp0 ( config.matching, "regex" ) == 0 ) {
+ config.matching_method = MM_REGEX;
+ }
+ else if ( g_strcmp0 ( config.matching, "glob" ) == 0 ) {
+ config.matching_method = MM_GLOB;
+ }
+ else if ( g_strcmp0 ( config.matching, "fuzzy" ) == 0 ) {
+ config.matching_method = MM_FUZZY;
+ }
+ else if ( g_strcmp0 ( config.matching, "normal" ) == 0 ) {
+ config.matching_method = MM_NORMAL;;
+ }
+ else {
+ g_string_append_printf ( msg, "\t<b>config.matching</b>=%s is not a valid matching strategy.\nValid options are: glob, regex, fuzzy or normal.\n",
+ config.matching );
+ found_error = 1;
+ }
+ }
+
if ( config.element_height < 1 ) {
g_string_append_printf ( msg, "\t<b>config.element_height</b>=%d is invalid. An element needs to be atleast 1 line high.\n",
config.element_height );
diff --git a/source/rofi.c b/source/rofi.c
index cd0fc842..1f7f290f 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -73,9 +73,9 @@ struct xkb_stuff xkb = {
.keymap = NULL,
.state = NULL,
.compose = {
- .table = NULL,
- .state = NULL
-}
+ .table = NULL,
+ .state = NULL
+ }
};
char *config_path = NULL;
// Array of modi.
@@ -466,22 +466,22 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id );
break;
case XCB_XKB_STATE_NOTIFY:
- {
- xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
- guint modmask;
- xkb_state_update_mask ( xkb.state,
- ksne->baseMods,
- ksne->latchedMods,
- ksne->lockedMods,
- ksne->baseGroup,
- ksne->latchedGroup,
- ksne->lockedGroup );
- modmask = x11_get_current_mask ( &xkb );
- if ( modmask == 0 ) {
- abe_trigger_release ( );
- }
- break;
+ {
+ xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
+ guint modmask;
+ xkb_state_update_mask ( xkb.state,
+ ksne->baseMods,
+ ksne->latchedMods,
+ ksne->lockedMods,
+ ksne->baseGroup,
+ ksne->latchedGroup,
+ ksne->lockedGroup );
+ modmask = x11_get_current_mask ( &xkb );
+ if ( modmask == 0 ) {
+ abe_trigger_release ( );
}
+ break;
+ }
}
return G_SOURCE_CONTINUE;
}
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index b6681a79..f30721b7 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -79,116 +79,114 @@ typedef struct
* Currently supports string, boolean and number (signed and unsigned).
*/
static XrmOption xrmOptions[] = {
- { xrm_String, "switchers", { .str = &config.modi }, NULL,
+ { xrm_String, "switchers", { .str = &config.modi }, NULL,
"", CONFIG_DEFAULT },
- { xrm_String, "modi", { .str = &config.modi }, NULL,
+ { xrm_String, "modi", { .str = &config.modi }, NULL,
"Enabled modi", CONFIG_DEFAULT },
- { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL,
+ { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL,
"Window opacity", CONFIG_DEFAULT },
- { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
+ { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
"Window width", CONFIG_DEFAULT },
- { xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
+ { xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
"Number of lines", CONFIG_DEFAULT },
- { xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
+ { xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
"Number of columns", CONFIG_DEFAULT },
- { xrm_String, "font", { .str = &config.menu_font }, NULL,
+ { xrm_String, "font", { .str = &config.menu_font }, NULL,
"Font to use", CONFIG_DEFAULT },
- { xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
+ { xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
"Color scheme for normal row", CONFIG_DEFAULT },
- { xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
+ { xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
"Color scheme for urgent row", CONFIG_DEFAULT },
- { xrm_String, "color-active", { .str = &config.color_active }, NULL,
+ { xrm_String, "color-active", { .str = &config.color_active }, NULL,
"Color scheme for active row", CONFIG_DEFAULT },
- { xrm_String, "color-window", { .str = &config.color_window }, NULL,
+ { xrm_String, "color-window", { .str = &config.color_window }, NULL,
"Color scheme window", CONFIG_DEFAULT },
- { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
+ { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
"", CONFIG_DEFAULT },
- { xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
+ { xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
"Border width", CONFIG_DEFAULT },
- { xrm_Number, "location", { .num = &config.location }, NULL,
+ { xrm_Number, "location", { .num = &config.location }, NULL,
"Location on screen", CONFIG_DEFAULT },
- { xrm_Number, "padding", { .num = &config.padding }, NULL,
+ { xrm_Number, "padding", { .num = &config.padding }, NULL,
"Padding", CONFIG_DEFAULT },
- { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
+ { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
"Y-offset relative to location", CONFIG_DEFAULT },
- { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
+ { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
"X-offset relative to location", CONFIG_DEFAULT },
- { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
+ { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
"Always show number of lines", CONFIG_DEFAULT },
- { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
+ { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
"Terminal to use", CONFIG_DEFAULT },
- { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
+ { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
"Ssh client to use", CONFIG_DEFAULT },
- { xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
+ { xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
"Ssh command to execute", CONFIG_DEFAULT },
- { xrm_String, "run-command", { .str = &config.run_command }, NULL,
+ { xrm_String, "run-command", { .str = &config.run_command }, NULL,
"Run command to execute", CONFIG_DEFAULT },
- { xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
+ { xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
"Command to get extra run targets", CONFIG_DEFAULT },
- { xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
+ { xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
"Run command to execute that runs in shell", CONFIG_DEFAULT },
- { xrm_String, "window-command", { .str = &config.window_command }, NULL,
+ { xrm_String, "window-command", { .str = &config.window_command }, NULL,
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
- { xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
+ { xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
"Disable history in run/ssh", CONFIG_DEFAULT },
- { xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
+ { xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
"Use levenshtein sorting", CONFIG_DEFAULT },
- { xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
+ { xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
"Set case-sensitivity", CONFIG_DEFAULT },
- { xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
+ { xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
"Cycle through the results list", CONFIG_DEFAULT },
- { xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
+ { xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
"Enable sidebar-mode", CONFIG_DEFAULT },
- { xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
+ { xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
"Row height (in chars)", CONFIG_DEFAULT },
- { xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
+ { xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
"Enable auto select mode", CONFIG_DEFAULT },
- { xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
+ { xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
- { xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
+ { xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
- { xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
+ { xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
- { xrm_Boolean, "glob", { .num = &config.glob }, NULL,
- "Use glob matching", CONFIG_DEFAULT },
- { xrm_Boolean, "regex", { .num = &config.regex }, NULL,
- "Use regex matching", CONFIG_DEFAULT },
- { xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
+ { xrm_String, "matching", { .str = &config.matching }, NULL,
+ "Set the matching algorithm. (normal, regex, glob, fuzzy)", CONFIG_DEFAULT },
+ { xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
"Tokenize input string", CONFIG_DEFAULT },
- { xrm_String, "monitor", { .str = &config.monitor }, NULL,
+ { xrm_String, "monitor", { .str = &config.monitor }, NULL,
"", CONFIG_DEFAULT },
/* Alias for dmenu compatibility. */
- { xrm_String, "m", { .str = &config.monitor }, NULL,
+ { xrm_String, "m", { .str = &config.monitor }, NULL,
"Monitor id to show on", CONFIG_DEFAULT },
- { xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
+ { xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
"Margin between rows", CONFIG_DEFAULT },
- { xrm_String, "filter", { .str = &config.filter }, NULL,
+ { xrm_String, "filter", { .str = &config.filter }, NULL,
"Pre-set filter", CONFIG_DEFAULT },
- { xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
+ { xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
"Separator style (none, dash, solid)", CONFIG_DEFAULT },
- { xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
+ { xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
"Hide scroll-bar", CONFIG_DEFAULT },
- { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
+ { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
"Fullscreen", CONFIG_DEFAULT },
- { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
+ { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
"Fake transparency", CONFIG_DEFAULT },
- { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
+ { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
"DPI", CONFIG_DEFAULT },
- { xrm_Number, "threads", { .num = &config.threads }, NULL,
+ { xrm_Number, "threads", { .num = &config.threads }, NULL,
"Threads to use for string matching", CONFIG_DEFAULT },
- { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
+ { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
"Scrollbar width", CONFIG_DEFAULT },
- { xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
+ { xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
- { xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
+ { xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
- { xrm_String, "window-format", { .str = &config.window_format }, NULL,
+ { xrm_String, "window-format", { .str = &config.window_format }, NULL,
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
};
diff --git a/test/run_glob_test.sh b/test/run_glob_test.sh
index 800b6222..52a5595a 100755
--- a/test/run_glob_test.sh
+++ b/test/run_glob_test.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-echo -en "nooty\naap\nnoot\nmies" | rofi -glob -dmenu > output.txt &
+echo -en "nooty\naap\nnoot\nmies" | rofi -matching glob -dmenu > output.txt &
RPID=$!
# send enter.
diff --git a/test/run_regex_test.sh b/test/run_regex_test.sh
index 454a9686..55c18e13 100755
--- a/test/run_regex_test.sh
+++ b/test/run_regex_test.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-echo -en "nooty\naap\nnoot\nmies" | rofi -regex -dmenu > output.txt &
+echo -en "nooty\naap\nnoot\nmies" | rofi -matching regex -dmenu > output.txt &
RPID=$!
# send enter.