I am a huge fan of the terminal-based music player cmus. It does everything I want from a music player and nothing I don't. I want to use it instead of iTunes on my Macbook. I installed it via homebrew and it's working great, except for one thing...
I'm trying to set up a system hotkey to play/pause cmus even if it's not focused. cmus provides a command-line program to help you do this.
Running that from anywhere will connect to the running cmus instance via a socket and issue the play/pause command.
So I'm trying to set up a system hotkey to run that command and play/pause cmus. As suggested in another answer, I've tried creating an Automator service workflow that runs the script. So hotkey starts the Automator service which runs the shell script which runs
Now here's the real problem:
This Automator workflow works perfectly when I run it from the Automator edit interface, but it always fails when I try to run it as a service. The error message contains no useful information, just "The action “Run Shell Script” encountered an error."
I've attempted to put some debugging output into my script:
echo "AUTOMATION STARTED" >> ~/automation.txt /usr/local/bin/cmus-remote --pause 2>&1 >> ~/automation.txt
When I read that file, all I see is:
Clearly the workflow is starting and running, and it's the
cmus-remote command itself that is failing.
- Why this would
cmus-remotework inside the Automator GUI, but die mysteriously outside of it?
- Is there anyway to get more failure info out of cmus?
- Are there open-source alternatives to Automator for binding system hotkeys to simple shell commands?