Skip to content

Commit

Permalink
Merge pull request matryer#1482 from sprak3000/issue-1468-now-playing…
Browse files Browse the repository at this point in the history
…-catalina

Issue matryer#1468 - Now Playing opens Podcasts in Catalina
  • Loading branch information
matryer authored Dec 11, 2020
2 parents f091079 + f9c5a0b commit 34c9fa1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Music/nowplaying.5s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
# <bitbar.abouturl></bitbar.abouturl>

# first, determine if there's an app that's playing or paused
apps=(iTunes Music Spotify Vox)
apps=(Music Spotify Vox)
playing=""
paused=""

# Determine if we are running a pre-Catalina OS X version and adjust the apps accordingly.
osx_ver_before_catalina=$(sw_vers -productVersion | grep -E "10\.\d[0-4]+\..*")
if [ -n "$osx_ver_before_catalina" ]; then
apps=(iTunes Spotify Vox)
fi

for i in "${apps[@]}"; do
# is the app running?
app_state=$(osascript -e "application \"$i\" is running")
Expand Down Expand Up @@ -87,7 +93,7 @@ else
track_query="track"
artist_query="artist"
fi

# output the track and artist
track=$(osascript -e "tell application \"$app\" to $track_query")
artist=$(osascript -e "tell application \"$app\" to $artist_query")
Expand Down

0 comments on commit 34c9fa1

Please sign in to comment.