mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Add sorting switch: Issue: #298
This commit is contained in:
parent
08d6d6b685
commit
f3c22c50e4
7 changed files with 16 additions and 4 deletions
|
@ -10,6 +10,7 @@
|
||||||
- Dmenu can read from file instead of stdin.
|
- Dmenu can read from file instead of stdin.
|
||||||
- Regex matching (#113)
|
- Regex matching (#113)
|
||||||
- Take Screenshot of rofi using keybinding.
|
- Take Screenshot of rofi using keybinding.
|
||||||
|
- Hotkey for sorting: (#298)
|
||||||
Improvements:
|
Improvements:
|
||||||
- Fix return code of multi-select.
|
- Fix return code of multi-select.
|
||||||
- Update manpage (#289, #291)
|
- Update manpage (#289, #291)
|
||||||
|
|
|
@ -155,6 +155,7 @@ Type `Shift-Right` to switch from Window list mode to Run mode and back.
|
||||||
|`Ctrl-space` | Set selected item as input text. |
|
|`Ctrl-space` | Set selected item as input text. |
|
||||||
|`Shift-Del` | Delete entry from history. |
|
|`Shift-Del` | Delete entry from history. |
|
||||||
|`grave` | Toggle case sensitivity. |
|
|`grave` | Toggle case sensitivity. |
|
||||||
|
|`Alt-grave` | Toggle levenshtein sort. |
|
||||||
|`Alt-Shift-S` | Take a screenshot and store this in the Pictures directory. |
|
|`Alt-Shift-S` | Take a screenshot and store this in the Pictures directory. |
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -779,6 +779,7 @@ The first two fields specify the alpha level. This determines the amount of tran
|
||||||
* `Ctrl-space`: Set selected item as input text.
|
* `Ctrl-space`: Set selected item as input text.
|
||||||
* `Shift-Del`: Delete entry from history.
|
* `Shift-Del`: Delete entry from history.
|
||||||
* `grave`: Toggle case sensitivity.
|
* `grave`: Toggle case sensitivity.
|
||||||
|
* `Alt-grave`: Toggle levenshtein sorting.
|
||||||
* `Alt-Shift-S`: Take a screenshot and store this in the Pictures directory.
|
* `Alt-Shift-S`: Take a screenshot and store this in the Pictures directory.
|
||||||
|
|
||||||
To get a full list of keybindings, see `rofi -dump-xresources | grep kb-`.
|
To get a full list of keybindings, see `rofi -dump-xresources | grep kb-`.
|
||||||
|
|
|
@ -1300,6 +1300,9 @@ The first two fields specify the alpha level\. This determines the amount of tra
|
||||||
\fBgrave\fR: Toggle case sensitivity\.
|
\fBgrave\fR: Toggle case sensitivity\.
|
||||||
.
|
.
|
||||||
.IP "\(bu" 4
|
.IP "\(bu" 4
|
||||||
|
\fBAlt\-grave\fR: Toggle levenshtein sorting\.
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
\fBAlt\-Shift\-S\fR: Take a screenshot and store this in the Pictures directory\.
|
\fBAlt\-Shift\-S\fR: Take a screenshot and store this in the Pictures directory\.
|
||||||
.
|
.
|
||||||
.IP "" 0
|
.IP "" 0
|
||||||
|
|
|
@ -54,6 +54,7 @@ typedef enum _KeyBindingAction
|
||||||
CUSTOM_18,
|
CUSTOM_18,
|
||||||
CUSTOM_19,
|
CUSTOM_19,
|
||||||
SCREENSHOT,
|
SCREENSHOT,
|
||||||
|
TOGGLE_SORT,
|
||||||
NUM_ABE
|
NUM_ABE
|
||||||
} KeyBindingAction;
|
} KeyBindingAction;
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ DefaultBinding bindings[NUM_ABE] =
|
||||||
{ .id = CUSTOM_17, .name = "kb-custom-17", .keybinding = "Alt+Shift+7" },
|
{ .id = CUSTOM_17, .name = "kb-custom-17", .keybinding = "Alt+Shift+7" },
|
||||||
{ .id = CUSTOM_19, .name = "kb-custom-19", .keybinding = "Alt+Shift+9" },
|
{ .id = CUSTOM_19, .name = "kb-custom-19", .keybinding = "Alt+Shift+9" },
|
||||||
{ .id = SCREENSHOT, .name = "kb-screenshot", .keybinding = "Alt+Shift+S" },
|
{ .id = SCREENSHOT, .name = "kb-screenshot", .keybinding = "Alt+Shift+S" },
|
||||||
|
{ .id = TOGGLE_SORT, .name = "kb-toggle-sort", .keybinding = "Alt+grave" },
|
||||||
};
|
};
|
||||||
|
|
||||||
void setup_abe ( void )
|
void setup_abe ( void )
|
||||||
|
|
|
@ -1390,9 +1390,7 @@ MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_l
|
||||||
scrollbar_set_max_value ( state.scrollbar, state.num_lines );
|
scrollbar_set_max_value ( state.scrollbar, state.num_lines );
|
||||||
// filtered list
|
// filtered list
|
||||||
state.line_map = g_malloc0_n ( state.num_lines, sizeof ( unsigned int ) );
|
state.line_map = g_malloc0_n ( state.num_lines, sizeof ( unsigned int ) );
|
||||||
if ( config.levenshtein_sort ) {
|
|
||||||
state.distance = (int *) g_malloc0_n ( state.num_lines, sizeof ( int ) );
|
state.distance = (int *) g_malloc0_n ( state.num_lines, sizeof ( int ) );
|
||||||
}
|
|
||||||
|
|
||||||
// resize window vertically to suit
|
// resize window vertically to suit
|
||||||
// Subtract the margin of the last row.
|
// Subtract the margin of the last row.
|
||||||
|
@ -1565,6 +1563,12 @@ MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_l
|
||||||
menu_capture_screenshot ( );
|
menu_capture_screenshot ( );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ( abe_test_action ( TOGGLE_SORT, ev.xkey.state, key ) ) {
|
||||||
|
config.levenshtein_sort = !config.levenshtein_sort;
|
||||||
|
state.refilter = TRUE;
|
||||||
|
state.update = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
else if ( abe_test_action ( MODE_PREVIOUS, ev.xkey.state, key ) ) {
|
else if ( abe_test_action ( MODE_PREVIOUS, ev.xkey.state, key ) ) {
|
||||||
state.retv = MENU_PREVIOUS;
|
state.retv = MENU_PREVIOUS;
|
||||||
*( state.selected_line ) = 0;
|
*( state.selected_line ) = 0;
|
||||||
|
|
Loading…
Reference in a new issue