Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to enable the kb-delete-entry in script mode #2087

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading