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

[REQUEST] New keybind to keep rofi open after selection #1595

Open
2 tasks done
vedxyz opened this issue Feb 14, 2022 · 2 comments
Open
2 tasks done

[REQUEST] New keybind to keep rofi open after selection #1595

vedxyz opened this issue Feb 14, 2022 · 2 comments

Comments

@vedxyz
Copy link

vedxyz commented Feb 14, 2022

Before opening a feature request

  • I checked the next branch to see if the feature has already been implemented
  • I searched existing reports to see if it is already requested.

What is the user problem or growth opportunity you want to see solved?

Launching multiple entries back to back is cumbersome. This feature would greatly speed up certain workflows where multiple selections are made regularly.

How do you know that this problem exists today? Why is this important?

I regularly need to launch multiple entries and it's slow to keep reopening the rofi window for each one. Keeping the workflow within rofi instead of using external scripts is preferable to me.

Who will benefit from it?

Anyone with a workflow that would benefit from selecting multiple entries in one rofi window.

Rofi version (rofi -v)

1.7.3

Configuration

N/A

Additional information

Relevant discussion:

My idea is to add a keybind (kb-accept-persist?) that would behave identically to the existing accept keybind but would keep rofi open instead of quitting on selection.
This should hopefully be a simple and non-intrusive feature as no one should be getting affected so long as the keybind isn't used.

I'm inexperienced with the rofi codebase but I would be willing to work on this myself too.

rofi/source/view.c

Lines 1455 to 1469 in eff3b86

case ACCEPT_ENTRY: {
// If a valid item is selected, return that..
unsigned int selected = listview_get_selected(state->list_view);
state->selected_line = UINT32_MAX;
if (selected < state->filtered_lines) {
(state->selected_line) = state->line_map[selected];
state->retv = MENU_OK;
} else {
// Nothing entered and nothing selected.
state->retv = MENU_CUSTOM_INPUT;
}
state->quit = TRUE;
break;
}

At a quick glance, I found the code above where I think I would just need to add another trigger that doesn't set state->quit = true on selection. I would appreciate any other pointers to look out for, should I try implementing this.

Also, would this keybind need to be limited to certain modi's? Say, for the window modi, would not quitting rofi upon selection be a problem as rofi is supposed to give focus to another window? In that case, it might make sense to make this specific to modi's like run, drun, ssh, no?

@erik-overdahl
Copy link

You can try writing a script as documented in the rofi-script manpage or using the rofi-blocks plugin, although it would require re-implementing the mode you are using.

@DaveDavenport
Copy link
Collaborator

This should be implemented in the mode itself, see also the implementation of the 'close-on-delete' option in the window browser, the return value of the result function should be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants