diff --git a/src/segments/spotify_darwin.go b/src/segments/spotify_darwin.go index 61ba5c05..d468ceef 100644 --- a/src/segments/spotify_darwin.go +++ b/src/segments/spotify_darwin.go @@ -3,24 +3,28 @@ package segments func (s *Spotify) Enabled() bool { - var err error // Check if running running := s.runAppleScriptCommand("application \"Spotify\" is running") if running == "false" || running == "" { s.Status = stopped return false } + s.Status = s.runAppleScriptCommand("tell application \"Spotify\" to player state as string") - if err != nil { + + if len(s.Status) == 0 { s.Status = stopped return false } + if s.Status == stopped { return false } + s.Artist = s.runAppleScriptCommand("tell application \"Spotify\" to artist of current track as string") s.Track = s.runAppleScriptCommand("tell application \"Spotify\" to name of current track as string") s.resolveIcon() + return true }