2010/03/10

Spotify global hotkeys - AutoHotkey script

My script is based on one I found here.

Hotkeys:

Previous trackWin+1
Play/pauseWin+2
Next trackWin+3
Volume downWin+Q
Volume upWin+W

Script:
#1::
; Previous track
ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow
return

#2::
; Play/pause
ControlSend, ahk_parent, {Space}, ahk_class SpotifyMainWindow
return

#3::
; Next track
ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow
return

#q::
; Volume down
ControlSend, ahk_parent, ^{Down}, ahk_class SpotifyMainWindow
return

#w::
; Volume up
ControlSend, ahk_parent, ^{Up}, ahk_class SpotifyMainWindow
return
How does it work:

It's very simple - I just mapped my favourite audio player hotkeys to default Spotify keyboard shortcuts, e.g. #1 means Win+1 in AutoHotkey syntax and pressing this hotkey sends ^{Left} (i.e. Crtl+Left) to main window of Spotify application.

7 comments:

  1. I confirm it works, however, only when spotify is not minimized to the tray bar (ie it actually has a window AutoHotKey can send message to).

    ReplyDelete
  2. Check out toastify

    ReplyDelete
  3. Thank you to the comment above about Toastify.

    ReplyDelete
  4. Did you mean the Taskbar? I just tested the AutoHotKey script & it works correctly when Spotify is minimized to the Windows 7 Taskbar.

    I don't know of any way to minimize it to the system tray. That doesn't appear to be an option in Spotify. I use a free power menu app (and DM2) and they can usually minimize programs to the tray and neither can do this to the Spotify app.

    ReplyDelete
  5. I figured it out... finally. The "hide" feature only exists when clicking on the duplicate tray icon. Thanks for the recommendation regarding Toastify. I kept accidentally clicking on the taskbar icon and I was looking for a way to remove it and still be able to control it.

    Here's Toastify. It hasn't been updated in 2 years, but it still works even with the latest 0.5.2.84 version.
    http://toastify.codeplex.com/

    ReplyDelete
  6. Works fine on Windows XP as long as long as Spotify isn't minimized to the tray bar.

    ReplyDelete
  7. Yes it works. Was able to get my Logitech G35 headset side buttons working with Spotify using this. Use the script above exactly as it is and then mapped the G35 buttons to WindowsKey+1, WindowsKey+2 and WindowsKey+3. Use WindowsKey+Q and WindowsKey+W for volume of Spotify. Very slick and easiest fix for Logitech G35 and Spotify I've yet seen.

    Thanks man.

    ReplyDelete