Skip to content

Commit

Permalink
Fix bug where currently playing opens Music app (#15846)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalzuch authored Dec 19, 2024
1 parent 5927e56 commit 715145f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extensions/music/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Apple Music Changelog

## [Update Currently Playing] - 2024-12-13

- Fixed a bug where `Currently Playing` command would open the Music app if it was not running.

## [Update Currently Playing] - 2024-12-06

- Update `Currently Playing` command to show the currently playing track in the subtitle instead of the toast.
Expand Down
9 changes: 9 additions & 0 deletions extensions/music/src/util/scripts/current-track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ export const getCurrentTrack = (): TE.TaskEither<Error, Readonly<Track>> => {
return pipe(
runScript(`
set output to ""
tell application "System Events"
set isNotRunning to (count of (every process whose name is "Music")) = 0
end tell
if isNotRunning then
error
else
tell application "Music"
set t to (get current track)
set trackId to id of t
Expand All @@ -139,6 +146,8 @@ export const getCurrentTrack = (): TE.TaskEither<Error, Readonly<Track>> => {
set output to ${querystring}
end tell
end if
return output
`),
TE.map(parseQueryString<Track>())
Expand Down

0 comments on commit 715145f

Please sign in to comment.