friedow / centerpiece

Your trusty omnibox search.
MIT License
174 stars 6 forks source link

Feature request: Custom command plugins #156

Open pinpox opened 3 weeks ago

pinpox commented 3 weeks ago

It would be nice to have a generic "custom" plugin, that let's you configure a bash command to create a list and a bash command to act on the selection. This could be useful for a number of cases, I have included two examples as configuration format proposal below.

plugin:
  applications:
    enable: true
# ... 
  cusom:
    enable: true
    commands:
      - name: "Open code project"
        command: "ls -l ~/code"
        action: "foot --working-derectory ~/code/{}"
        icon: "font-awesome icon name"
      - name: "Mail contact"
        command: "cat ~/mail-addresses.txt"
        action: "neomutt -s 'mail from centerpiece' {}"
        icon: "font-awesome icon name"
# ...

In the configuation of each instance of the command should return a list of strings separted by newline and action should be a bash command to execute when pressing enter on a selection. Of course there needs to be some predefined placeholder (here {} e.g.) that get's interpolated into the command string. It also probably makes sense to add an icon property that specifies the font-awesome icon to use. Each entry in commands would then be shown the same way as other plugins are presented when launching centerpiece.