Running a terminal command from a hot key

I don't mean, having a terminal window receive keystrokes which would run the program.

I use the "chrome-cli" program (brew install chrome-cli) which gives some CLI control over chrome tabs... resizing, moving, etc. It can programatically loop over multiple tabs/windows etc, which is quite useful for what I am doing.

This is great when I'm typing in a terminal, but I would like to have a hotkey bound such that, it would run the program directly for me, without me having to open a terminal window.

For example, I can run the command "chrome-cli size 1024 768" to resize my top chrome window... perfect for setting up repeatable screen shots, etc.

Is there a way I can have this invokable through a Keyboard Macro, such that pressing that key invokes that command?

The Shell Script action should do what you want—it won't open a Terminal window. Just put in chrome-cli size 1024 768 and tell it to ignore the results. In theory, that should work. In reality, I don't have Chrome or chrome-cli so can't test it out :).


Works perfectly, many thanks!

Glad to hear it!