Wox-launcher / Wox

A cross-platform launcher that simply works
http://wox-launcher.github.io/Wox/
GNU General Public License v3.0
24.33k stars 2.36k forks source link

[Feature] Pipe result to handler plugin #3048

Closed dipique closed 8 months ago

dipique commented 4 years ago

Is your feature request related to a problem? Please describe. Plugins do two things:

  1. Return Results in response to a Query
  2. Perform an Action on a user-chosen Result

These two functionalities are very different; consider Everything (the application, not the plugin), which generates search Results but uses the windows context menu to supply the Action(s). This decoupling is extremely useful.

I would like to be able to choose the action for a result without the need to replicate the search plugin's functionality. For example, I would like to search for a file and open it, edit it, delete it, and any other arbitrary Action. I would like to build that Action functionality without needing to duplicate the functionality of Everything, or even to depend on Everything specifically.

Describe the solution you'd like Provide an optional pipe syntax that specifies an alternative handler using a non-optional action word. For example, I have a plugin that uploads a video file to youtube. I would like to type:

yt | my_new_video.mkv

The meaning of this command would be:

  1. Search for my_new_video.mkv (i.e. the string after an plugin action word + ' | ') using existing rules and plugins
  2. When a result is selected (and pipe syntax is enabled), send the Result to the yt plugin
  3. The plugin receives the Result and returns a new Result
  4. Wox executes the new Result

In other words, the yt plugin would transform the Result object, but the execution of that Result would remain unchanged.

Describe alternatives you've considered To provide the functionality above, I could use the Everything skd to build a plugin that uses that functionality but performs the upload action. However, this means that 1) I would need to duplicate the functionality of the Everything plugin, and 2) I would not be able to use the results from any other plugin (e.g. one that provides access to online files).

enria commented 4 years ago
  1. If return a search result for your plugin, how do you kown the exact meaning of the result item? It just contains a title and a subtitle. For one result, its meaning is highly depended on the plugin that produce it.
  2. Just for your requirment, it can be achieved through the following steps. Firstly, add "copy the file path" to the Everything plugin context menu (and it is also useful for other users). Secondly, use the copyed file path for your plugin that uploads vedio file to youtube. In addition, I highly reconmend that use a script such as a Python file rather than a plugin to realize something as trivial as uploading a video to youtube, and we need a plugin to manage such scripts.
qianlifeng commented 10 months ago

I think you need something like Universal Actions in Alfred. You just select my_new_video.mkv and hit a hotkey, a list will popup waiting for you filter, like

  1. yt - upload this video
  2. compress - compress this video

We will support kind of this in v2

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 3 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stale for 10 days with no activity. If you feel this issue still needs attention please feel free to reopen.