davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.24k stars 613 forks source link

Feature Request: Keyword support #746

Open paul opened 6 years ago

paul commented 6 years ago

Hi! First of all, thanks so much for working on rofi. After using OSX for several years, I finally switched back to Linux about a year ago, and Rofi is the best application launcher tool I’ve found so far. I really like its minimalist nature and speed. That said, one feature I’m missing from Alfred is its support of “keywords” to launch scripts or plugins.

For example, on Alfred I had a “GitHub” plugin attached to the keyword “gh”. In the Alfred launcher, if I typed “gh rofi”, the plugin would trigger a script to use GitHub’s search API to find “rofi”, and then when I pressed “” it would launch the browser to open the item I picked.

I’ve tried my hand at scripting with rofi, and I think I can launch rofi incombi mode that includes my script, but it wouldn’t to anything to recognize my keyword as a separate set of results. To get this separate behavior, I either have to launch rofi via a separate keyboard shortcut with different args to include only my script, or use Shift-Left to switch to the right modi “page”.

With Alfred, I had about a dozen of these keyword plugins that were extremely useful to my workflow. I’d love it if I could somehow implement similar scripts for rofi, too. Am I missing an easier way to accomplish this in rofi?

Thanks!

DaveDavenport commented 6 years ago

There is not direct support, you can however in combi mode do:

!r firefox

To launch firefox using the run plugin. If your own is called gh you can do

!gh rofi
paul commented 6 years ago

Thanks, that was helpful, I didn't know about !. Is there any way to tell rofi to not try and execute the script on first launch when the input is still empty? For example, I'd like to have my gh script load my "starred" repos if the input is empty, but only if if used !gh to start it. Otherwise, it tries to run every time rofi is launched, making the API call, and slowing down the rofi popup by 500+ms even if I'm just trying to switch windows. Is there any way for my script to detect if its being launched with !gh or not?