1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Switch to stop cycling feature (#407)

* Added 'cycle' option to switch list navigation wrapping

* Replaced tabs with spaces

* Updating the expected rofi properties with 'cycle' option

* Updating documentation with the 'cycle' option
This commit is contained in:
Yaroslav 2016-05-25 14:40:23 -04:00 committed by Dave Davenport
parent 17e9398699
commit f901494c6a
7 changed files with 28 additions and 7 deletions

View file

@ -94,6 +94,8 @@ Settings config = {
.levenshtein_sort = FALSE,
/** Case sensitivity of the search */
.case_sensitive = FALSE,
/** Cycle through in the element list */
.cycle = TRUE,
/** Height of an element in #chars */
.element_height = 1,
/** Sidebar mode, show the modi */

View file

@ -26,6 +26,7 @@
[ -disable-history ]
[ -levenshtein-sort ]
[ -case-sensitive ]
[ -cycle ]
[ -show *mode* ]
[ -modi *mode1,mode2* ]
[ -eh *element height* ]
@ -185,6 +186,10 @@ Example: Have a mode 'Workspaces' using the `i3_switch_workspace.sh` script:
Start in case sensitive mode.
`-cycle`
Cycle through the results list. Default is 'true'.
`-fuzzy`
Enable experimental fuzzy matching.

View file

@ -7,7 +7,7 @@
\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 ] [ \-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 ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-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 ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-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 ]
.
.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\.
@ -268,6 +268,12 @@ rofi \-modi "window,run,ssh,Workspaces:i3_switch_workspaces\.sh" \-show Workspac
Start in case sensitive mode\.
.
.P
\fB\-cycle\fR
.
.P
Cycle through the results list\. Default is 'true'\.
.
.P
\fB\-fuzzy\fR
.
.P

View file

@ -50,6 +50,8 @@ rofi.disable-history: false
rofi.levenshtein-sort: false
! Set case-sensitivity
rofi.case-sensitive: false
! Cycle through the results list
rofi.cycle: true
! Enable sidebar-mode
rofi.sidebar-mode: false
! Row height (in chars)

View file

@ -90,6 +90,8 @@ typedef struct
unsigned int levenshtein_sort;
/** Search case sensitivity */
unsigned int case_sensitive;
/** Cycle through in the element list */
unsigned int cycle;
/** Height of an element in number of rows */
int element_height;
/** Sidebar mode, show the modi */

View file

@ -798,14 +798,16 @@ inline static void rofi_view_nav_left ( RofiViewState *state )
*/
inline static void rofi_view_nav_up ( RofiViewState *state )
{
// If no lines or don't cycle, do nothing.
if ( state->filtered_lines == 0 || ( state->selected == 0 && !config.cycle ) ) {
return;
}
// Wrap around.
if ( state->selected == 0 ) {
state->selected = state->filtered_lines;
}
if ( state->selected > 0 ) {
state->selected--;
}
state->selected--;
state->update = TRUE;
}
@ -817,8 +819,8 @@ inline static void rofi_view_nav_up ( RofiViewState *state )
*/
inline static void rofi_view_nav_down ( RofiViewState *state )
{
// If no lines, do nothing.
if ( state->filtered_lines == 0 ) {
// If no lines or don't cycle, do nothing.
if ( state->filtered_lines == 0 || ( state->selected == state->filtered_lines - 1 && !config.cycle ) ) {
return;
}
state->selected = state->selected < state->filtered_lines - 1 ? MIN ( state->filtered_lines - 1, state->selected + 1 ) : 0;

View file

@ -125,6 +125,8 @@ static XrmOption xrmOptions[] = {
"Use levenshtein sorting" },
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
"Set case-sensitivity" },
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
"Cycle through the results list" },
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
"Enable sidebar-mode" },
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,