Idea:
Not just expose "left"/"right"/"other" for a mouse click, but also the button code.
It will be useful for a modern mouse with extra buttons (e.g. mine has forward/back buttons).
case "$BUTTON" in
"left")
PLAYER_STATE=$(osascript -e "tell application \"Music\" to set playerState to (get player state) as text")
if [[ $PLAYER_STATE == "paused" ]]; then
osascript -e 'tell application "Music" to play'
else
osascript -e 'tell application "Music" to pause'
fi
;;
"right")
osascript -e 'tell application "Music" to next track'
;;
"other")
case "$BUTTON_CODE" in
"3")
osascript -e 'tell application "Music" to back track'
;;
"4")
osascript -e 'tell application "Music" to next track'
;;
*)
osascript -e 'tell application "Music" to back track'
;;
esac
;;
esac
Idea: Not just expose "left"/"right"/"other" for a mouse click, but also the button code. It will be useful for a modern mouse with extra buttons (e.g. mine has forward/back buttons).
Which can be get by
I am not proficient in Objective-C and Apple GUI frameworks.
POC: https://github.com/fuyu0425/SketchyBar/commit/9eac182eb0bd6fe9a544a0351527c8879a46f445
My Own Usage for a script to control Music App.