-2

I want to trap to media key presses on a Mac, assuming that my script is running in background.

Is that possible? This is what I have.

#!/bin/bash

while :
do
    read -t 1 -n 1 key
    echo $key;
done
-1

Maybe ask the question in at the Unix & Linux site. Bash scripts behaving similar in Linux and macOS because both systems use Unix. Also consider to use Apple script.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .