local iconBgColor = rgbm(0, 0, 0, 1)

return function (dt)
  if(ac.currentlyPlaying().isPlaying and ac.currentlyPlaying().hasCover) then
    if(ac.currentlyPlaying().sourceID =='SPOTIFY') then
    system.statusIconMusicCover(ac.currentlyPlaying(), iconBgColor)
  else
    system.statusIcon(ac.currentlyPlaying(), iconBgColor)
  end
  else
    system.statusIcon(system.appIcon(), iconBgColor)
  end
  ui.sameLine(0, 12)
  ui.offsetCursorY(-5)
  --ui.dwriteTextAligned(ac.currentlyPlaying().title, 20, ui.Alignment.Start, ui.Alignment.Start, vec2(ui.availableSpace().x/1.2,ui.availableSpace().y))
  ui.dwriteTextAligned(ac.currentlyPlaying().title, system.adjustTextSize(ac.currentlyPlaying().title, 20, ui.availableSpace().x/1.2),ui.Alignment.Start, ui.Alignment.Center, vec2(ui.availableSpace().x/1.2,ui.availableSpace().y/1.4))
  --ui.newLine(1)
  --ui.dwriteTextAligned(ac.currentlyPlaying().artist, 15, ui.Alignment.Start, ui.Alignment.Start, ui.availableSpace())

 -- if system.statusButton(ui.Icons.Back, 34) then
  --  ac.mediaPreviousTrack()
 -- end

  --if system.statusButton(ac.currentlyPlaying().isPlaying and ui.Icons.Pause or ui.Icons.Play, 34) then
  --  ac.mediaPlayPause()
 -- end

  if system.statusButton(ui.Icons.Next, 0) then
    ac.mediaNextTrack()
  end

  ui.newLine(1)
  ui.offsetCursorX(46)
  ui.offsetCursorY(-39)
  ui.dwriteTextAligned(ac.currentlyPlaying().artist, 13, ui.Alignment.Start, ui.Alignment.Start, ui.availableSpace())

end

