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.