Skip to content

Commit

Permalink
Add option to enable the kb-delete-entry in script mode (#2087)
Browse files Browse the repository at this point in the history
* Add option to enable the `kb-delete-entry` in script mode

* Remove `use-delete` option
  • Loading branch information
douo authored Jan 22, 2025
1 parent 5b95abc commit 5870040
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/rofi-script.5.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ An integer number with the current state:
- **0**: Initial call of script.
- **1**: Selected an entry.
- **2**: Selected a custom entry.
- **3**: Deleted an entry.
- **10-28**: Custom keybinding 1-19 ( need to be explicitly enabled by script ).

### `ROFI_INFO`
Expand Down Expand Up @@ -109,7 +110,7 @@ The following extra options exists:
- **keep-selection**: If set, the selection is not moved to the first entry,
but the current position is maintained. The filter is cleared.

- **keep-filter**: If set, the filter is not cleared.
- **keep-filter**: If set, the filter is not cleared.

- **new-selection**: If `keep-selection` is set, this allows you to override
the selected entry (absolute position).
Expand Down
4 changes: 4 additions & 0 deletions source/modes/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ static ModeMode script_mode_result(Mode *sw, int mretv, char **input,
retv = (mretv & MENU_LOWER_MASK);
return retv;
}
} else if ((mretv & MENU_ENTRY_DELETE) && selected_line != UINT32_MAX) {
script_mode_reset_highlight(sw);
new_list = execute_executor(sw, rmpd->cmd_list[selected_line].entry, &new_length,
3, &(rmpd->cmd_list[selected_line]));
} else if ((mretv & MENU_OK) && rmpd->cmd_list[selected_line].entry != NULL) {
if (rmpd->cmd_list[selected_line].nonselectable) {
return RELOAD_DIALOG;
Expand Down

0 comments on commit 5870040

Please sign in to comment.