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
This commit is contained in:
Dave Davenport 2016-08-25 08:43:40 +02:00
parent a657f81145
commit 20e55e1e4e
13 changed files with 209 additions and 130 deletions

View File

@ -107,10 +107,10 @@ Settings config = {
/** Parse ~/.ssh/known_hosts file in ssh view. */ /** Parse ~/.ssh/known_hosts file in ssh view. */
.parse_known_hosts = TRUE, .parse_known_hosts = TRUE,
/** Modi to combine into one view. */ /** Modi to combine into one view. */
.combi_modi = "window,run", .combi_modi = "window,run",
.glob = FALSE, .tokenize = TRUE,
.tokenize = TRUE, .matching = "normal",
.regex = FALSE, .matching_method = MM_NORMAL,
/** Monitor */ /** Monitor */
.monitor = "-5", .monitor = "-5",
/** set line margin */ /** set line margin */

View File

@ -45,8 +45,7 @@
[ -combi-modi *mode1,mode2* ] [ -combi-modi *mode1,mode2* ]
[ -normal-window ] [ -normal-window ]
[ -fake-transparency ] [ -fake-transparency ]
[ -glob ] [ -matching *method* ]
[ -regex ]
[ -tokenize ] [ -tokenize ]
[ -threads *num* ] [ -threads *num* ]
[ -config *filename* ] [ -config *filename* ]
@ -275,14 +274,19 @@ Hide the scrollbar.
Set the scrollbar width. Set the scrollbar width.
`-glob` `-matching` *method*
Use glob style matching Specify the matching algorithm used.
*Warning this option might be slow on large lists* 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` `-tokenize`

View File

@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.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" .SH "NAME"
\fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement \fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement
. .
.SH "SYNOPSIS" .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" .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\. \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\. Set the scrollbar width\.
. .
.P .P
\fB\-glob\fR \fB\-matching\fR \fImethod\fR
. .
.P .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 .IP "\(bu" 4
\fB\-regex\fR \fBnormal\fR: Match the int string\.
. .
.P .IP "\(bu" 4
Use regex matching \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 .P
\fB\-tokenize\fR \fB\-tokenize\fR

View File

@ -64,10 +64,8 @@ rofi.parse-hosts: false
rofi.parse-known-hosts: true rofi.parse-known-hosts: true
! "Set the modi to combine in combi mode" Set from: File ! "Set the modi to combine in combi mode" Set from: File
rofi.combi-modi: window,drun,run,ssh rofi.combi-modi: window,drun,run,ssh
! "Use glob matching" Set from: File ! "Set the matching algorithm. (normal, regex, glob, fuzzy)" Set from: Default
rofi.glob: false ! rofi.matching: normal
! "Use regex matching" Set from: File
rofi.regex: false
! "Tokenize input string" Set from: File ! "Tokenize input string" Set from: File
rofi.tokenize: true rofi.tokenize: true
! "Monitor id to show on" Set from: File ! "Monitor id to show on" Set from: File

View File

@ -85,7 +85,6 @@ int find_arg_str ( const char * const key, char** val );
*/ */
int find_arg ( const char * const key ); int find_arg ( const char * const key );
/** /**
* @param tokens List of (input) tokens to match. * @param tokens List of (input) tokens to match.
* @param input The entry to match against. * @param input The entry to match against.

View File

@ -1,6 +1,19 @@
#ifndef ROFI_SETTINGS_H #ifndef ROFI_SETTINGS_H
#define ROFI_SETTINGS_H #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. * Enumeration indicating location or gravity of window.
* *
@ -105,9 +118,9 @@ typedef struct
unsigned int parse_known_hosts; unsigned int parse_known_hosts;
/** Combi Modes */ /** Combi Modes */
char *combi_modi; char *combi_modi;
unsigned int glob; char *matching;
MatchingMethod matching_method;
unsigned int tokenize; unsigned int tokenize;
unsigned int regex;
/** Monitors */ /** Monitors */
char *monitor; char *monitor;
/** Line margin */ /** Line margin */

View File

@ -39,16 +39,16 @@ typedef struct
typedef enum typedef enum
{ {
TB_AUTOHEIGHT = 1 << 0, TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1, TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16, TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17, TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18, TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19, TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20, TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21, TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22, TB_PASSWORD = 1 << 22,
TB_INDICATOR = 1 << 23, TB_INDICATOR = 1 << 23,
} TextboxFlags; } TextboxFlags;
typedef enum typedef enum

View File

@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
// Reading one line per time. // Reading one line per time.
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) { while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
// Evaluate one line. // Evaluate one line.
unsigned int index = 0, ti = 0; unsigned int index = 0, ti = 0;
char *token = buffer; char *token = buffer;
// Tokenize it. // Tokenize it.

View File

@ -168,28 +168,58 @@ static gchar *glob_to_regex ( const char *input )
} }
return r; 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 ) 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 ) #define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
GRegex * retv = NULL; GRegex * retv = NULL;
if ( config.glob ) { gchar *r;
gchar *r = glob_to_regex ( input ); switch ( config.matching_method )
{
case MM_GLOB:
r = glob_to_regex ( input );
retv = R ( r ); retv = R ( r );
g_free ( r ); g_free ( r );
} break;
else if ( config.regex ) { case MM_REGEX:
retv = R ( input ); retv = R ( input );
if ( retv == NULL ) { if ( retv == NULL ) {
gchar *r = g_regex_escape_string ( input, -1 ); r = g_regex_escape_string ( input, -1 );
retv = R ( r ); retv = R ( r );
g_free ( r ); g_free ( r );
} }
} break;
else{ case MM_FUZZY:
// TODO; regex should be default? r = fuzzy_to_regex ( input );
gchar *r = g_regex_escape_string ( input, -1 );
retv = R ( r ); retv = R ( r );
g_free ( r ); g_free ( r );
break;
default:
r = g_regex_escape_string ( input, -1 );
retv = R ( r );
g_free ( r );
break;
} }
return retv; return retv;
} }
@ -204,7 +234,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
} }
char *saveptr = NULL, *token; char *saveptr = NULL, *token;
GRegex **retv = NULL; GRegex **retv = NULL;
if ( !config.tokenize ) { if ( !config.tokenize ) {
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 ); retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
retv[0] = (GRegex *) create_regex ( input, case_sensitive ); 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; GMatchInfo *gmi = NULL;
g_regex_match ( (GRegex *) tokens[j], input, G_REGEX_MATCH_PARTIAL, &gmi ); g_regex_match ( (GRegex *) tokens[j], input, G_REGEX_MATCH_PARTIAL, &gmi );
while ( g_match_info_matches ( gmi ) ) { while ( g_match_info_matches ( gmi ) ) {
int start, end; int count = g_match_info_get_match_count ( gmi );
g_match_info_fetch_pos ( gmi, 0, &start, &end ); for ( int index = ( count > 1 ) ? 1 : 0; index < count; index++ ) {
PangoAttribute *pa = pango_attr_underline_new ( PANGO_UNDERLINE_SINGLE ); int start, end;
PangoAttribute *pa2 = pango_attr_weight_new ( PANGO_WEIGHT_BOLD ); g_match_info_fetch_pos ( gmi, index, &start, &end );
pa2->start_index = pa->start_index = start; PangoAttribute *pa = pango_attr_underline_new ( PANGO_UNDERLINE_SINGLE );
pa2->end_index = pa->end_index = end; PangoAttribute *pa2 = pango_attr_weight_new ( PANGO_WEIGHT_BOLD );
pango_attr_list_insert ( retv, pa ); pa2->start_index = pa->start_index = start;
pango_attr_list_insert ( retv, pa2 ); 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_next ( gmi, NULL );
} }
g_match_info_free ( gmi ); g_match_info_free ( gmi );
@ -362,7 +395,6 @@ PangoAttrList *token_match_get_pango_attr ( GRegex **tokens, const char *input,
return retv; return retv;
} }
int token_match ( GRegex * const *tokens, const char *input ) int token_match ( GRegex * const *tokens, const char *input )
{ {
int match = 1; int match = 1;
@ -458,6 +490,27 @@ int config_sanity_check ( void )
int found_error = FALSE; int found_error = FALSE;
GString *msg = g_string_new ( GString *msg = g_string_new (
"<big><b>The configuration failed to validate:</b></big>\n" ); "<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 ) { 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", 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 ); config.element_height );

View File

@ -73,9 +73,9 @@ struct xkb_stuff xkb = {
.keymap = NULL, .keymap = NULL,
.state = NULL, .state = NULL,
.compose = { .compose = {
.table = NULL, .table = NULL,
.state = NULL .state = NULL
} }
}; };
char *config_path = NULL; char *config_path = NULL;
// Array of modi. // 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 ); xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id );
break; break;
case XCB_XKB_STATE_NOTIFY: case XCB_XKB_STATE_NOTIFY:
{ {
xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev; xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
guint modmask; guint modmask;
xkb_state_update_mask ( xkb.state, xkb_state_update_mask ( xkb.state,
ksne->baseMods, ksne->baseMods,
ksne->latchedMods, ksne->latchedMods,
ksne->lockedMods, ksne->lockedMods,
ksne->baseGroup, ksne->baseGroup,
ksne->latchedGroup, ksne->latchedGroup,
ksne->lockedGroup ); ksne->lockedGroup );
modmask = x11_get_current_mask ( &xkb ); modmask = x11_get_current_mask ( &xkb );
if ( modmask == 0 ) { if ( modmask == 0 ) {
abe_trigger_release ( ); abe_trigger_release ( );
}
break;
} }
break;
}
} }
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }

View File

@ -79,116 +79,114 @@ typedef struct
* Currently supports string, boolean and number (signed and unsigned). * Currently supports string, boolean and number (signed and unsigned).
*/ */
static XrmOption xrmOptions[] = { static XrmOption xrmOptions[] = {
{ xrm_String, "switchers", { .str = &config.modi }, NULL, { xrm_String, "switchers", { .str = &config.modi }, NULL,
"", CONFIG_DEFAULT }, "", CONFIG_DEFAULT },
{ xrm_String, "modi", { .str = &config.modi }, NULL, { xrm_String, "modi", { .str = &config.modi }, NULL,
"Enabled modi", CONFIG_DEFAULT }, "Enabled modi", CONFIG_DEFAULT },
{ xrm_Number, "opacity", { .num = &config.window_opacity }, NULL, { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL,
"Window opacity", CONFIG_DEFAULT }, "Window opacity", CONFIG_DEFAULT },
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL, { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
"Window width", CONFIG_DEFAULT }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "Color scheme window", CONFIG_DEFAULT },
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL, { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
"", CONFIG_DEFAULT }, "", CONFIG_DEFAULT },
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL, { xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
"Border width", CONFIG_DEFAULT }, "Border width", CONFIG_DEFAULT },
{ xrm_Number, "location", { .num = &config.location }, NULL, { xrm_Number, "location", { .num = &config.location }, NULL,
"Location on screen", CONFIG_DEFAULT }, "Location on screen", CONFIG_DEFAULT },
{ xrm_Number, "padding", { .num = &config.padding }, NULL, { xrm_Number, "padding", { .num = &config.padding }, NULL,
"Padding", CONFIG_DEFAULT }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "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 }, "Set the modi to combine in combi mode", CONFIG_DEFAULT },
{ xrm_Boolean, "glob", { .num = &config.glob }, NULL, { xrm_String, "matching", { .str = &config.matching }, NULL,
"Use glob matching", CONFIG_DEFAULT }, "Set the matching algorithm. (normal, regex, glob, fuzzy)", CONFIG_DEFAULT },
{ xrm_Boolean, "regex", { .num = &config.regex }, NULL, { xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
"Use regex matching", CONFIG_DEFAULT },
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
"Tokenize input string", CONFIG_DEFAULT }, "Tokenize input string", CONFIG_DEFAULT },
{ xrm_String, "monitor", { .str = &config.monitor }, NULL, { xrm_String, "monitor", { .str = &config.monitor }, NULL,
"", CONFIG_DEFAULT }, "", CONFIG_DEFAULT },
/* Alias for dmenu compatibility. */ /* 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 }, "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 }, "Margin between rows", CONFIG_DEFAULT },
{ xrm_String, "filter", { .str = &config.filter }, NULL, { xrm_String, "filter", { .str = &config.filter }, NULL,
"Pre-set filter", CONFIG_DEFAULT }, "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 }, "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 }, "Hide scroll-bar", CONFIG_DEFAULT },
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
"Fullscreen", CONFIG_DEFAULT }, "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 }, "Fake transparency", CONFIG_DEFAULT },
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
"DPI", CONFIG_DEFAULT }, "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 }, "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 }, "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 }, "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 }, "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 }, "Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
}; };

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/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=$! RPID=$!
# send enter. # send enter.

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/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=$! RPID=$!
# send enter. # send enter.