Re-add zeltak mode.

This commit is contained in:
Dave Davenport 2015-02-24 17:34:25 +01:00
parent d3157e336f
commit a83a06a95c
7 changed files with 28 additions and 2 deletions

View File

@ -7,6 +7,7 @@
- Word movement in entry box. (#126)
- PID file to avoid duplicate Rofi.
- Generic keybinding and launching for modi. (#128)
- Auto select mode (previously called zeltak mode)
Bug fixes:
- Shift left/right movement between modi (#125)
- Document updates (#123,#116,#124,etc.)

View File

@ -102,6 +102,8 @@ Settings config = {
/** Sidebar mode, show the switchers */
.sidebar_mode = FALSE,
/** Lazy mode setting */
.lazy_filter_limit = 5000
.lazy_filter_limit = 5000,
/** auto select */
.auto_select = FALSE
};

View File

@ -43,6 +43,7 @@ rofi - A window switcher, run dialog and dmenu replacement
[ -version ]
[ -help]
[ -dump-xresources ]
[ -auto-select ]
## DESCRIPTION
@ -267,6 +268,10 @@ daemon listening to specific key-combinations.
Default: *5000*
`-auto-select`
When one entry is left, automatically select this.
### PATTERN setting
`-terminal`

View File

@ -41,6 +41,7 @@ rofi \- A window switcher, run dialog and dmenu replacement
[ \-version ]
[ \-help]
[ \-dump\-xresources ]
[ \-auto\-select ]
.SH DESCRIPTION
.PP
\fBrofi\fP is an X11 popup window switcher, run dialog, dmenu replacement and more. It focusses on
@ -340,6 +341,14 @@ To show sidebar use:
for 250ms. Experiments shows that the default (5000 lines) works well, set to 0 to always enable.
.PP
Default: \fI5000\fP
.PP
\fB\fC\-auto\-select\fR
.PP
.RS
.nf
When one entry is left, automatically select this.
.fi
.RE
.SS PATTERN setting
.PP
\fB\fC\-terminal\fR

View File

@ -198,6 +198,8 @@ typedef struct _Settings
unsigned int sidebar_mode;
/** Lazy filter limit. */
unsigned int lazy_filter_limit;
/** Auto select. */
unsigned int auto_select;
} Settings;
/** Global Settings structure. */

View File

@ -788,6 +788,12 @@ static void menu_refilter ( MenuState *state, char **lines, menu_match_cb mmc, v
}
state->selected = MIN ( state->selected, state->filtered_lines - 1 );
if ( config.auto_select == TRUE && state->filtered_lines == 1 ) {
*( state->selected_line ) = state->line_map[state->selected];
state->retv = MENU_OK;
state->quit = TRUE;
}
state->refilter = FALSE;
}

View File

@ -103,7 +103,8 @@ static XrmOption xrmOptions[] = {
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL },
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL },
{ xrm_Number, "lazy-filter-limit", { .num = &config.lazy_filter_limit }, NULL },
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL }
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL },
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL }
};
// Dynamic options.