buster / rrun

minimalistic command launcher in rust
GNU General Public License v2.0
112 stars 14 forks source link

implement helper shortcuts #3

Open buster opened 9 years ago

buster commented 9 years ago

I'd be nice to have some shortcuts to act on the content of the text (or interpret the text).

Ideas: Alt+g -> open browser with content (aka url) Alt+k -> fetch password from keepass (how?) Alt+z -> search/open zim

Alternative (text field tags): "g:" -> open browser with content (aka url) "kp:" -> fetch password from keepass "ku:" -> fetch user from keepass "z:<text" -> search/open zim for text/key

nightscape commented 8 years ago

I was working with Alfred on Mac and it has a very simple and effective plugin "API": You can link a trigger (e.g. a hotkey Alt+k or a string "kp" that you type into the launcher window) to an executable (e.g. keepass_plugin.sh). After executing the trigger, you can start typing a query text like "foo server". This query text will be passed to the executable as command line argument (actually, in Alfred the executable code can contain the text {query} and this text will be replaced with the actual query before launching the code, but a command line argument is much simpler) and the executable prints some XML to STDOUT which lists the possible completions along with additional information (e.g. id, description, icon). Alfred captures the STDOUTput and displays the completions. When the user selects one of the completions, the executable is run again with the id of the completion (and probably something that tells it, that we want to really run something and are not asking for completions) and the executable does what it's intended to. I'm currently switching back to Linux and a launcher with such a simple "API" is really lacking... I'm a Rust chicken, so generally interested in the language, but haven't written a single line of code yet. Do you think something like this would be hard?

Best Martin

buster commented 8 years ago

I Martin,

i think the work you are currently doing in the pull requests is awesome. Actually, what i really like is the regex/completion to runner approach that just relies on some external tools to be run.

When i was using gnome-do (similar tool to Alfred in Mono), i found it very hard to implement new completions. I very much like that rrun merely handles the dispatching to external tools, so that everyone who knows bash should be able to add completions! :+1

nightscape commented 8 years ago

I must say I'm quite amazed myself how well this works out :grin: I've created a Wiki page with snippets that I'm using myself. It would be nice to rewrite some of the Ruby code there in Rust and package the executables along with rrun so that one gets an even greater out-of-the-box experience, but for my part I'm quite happy with what we got :+1: :+1: :+1: