No keyboard shortcuts, let alone Save to Your Library
, are built into Spotify desktop apps and probably never will. In December 2016 they marked the request (originally from 2012) as "Not Right Now".
For macOS users I don't know a solution.
For Windows users AutoHotkey is a fairly workable.
Here is an AutoHotkey script that works as of 10-30-2017.
; Control+Shift+Win+F1
^+#F1:: SendInput {Media_Play_Pause}
; Control+Shift+Win+F2
^+#F2:: SendInput {Media_Prev}
; Control+Shift+Win+F3
^+#F3:: SendInput {Media_Next}
; Control+Shift+Win+F4
^+#F4:: SaveSongToSpotifyLibrary()
SaveSongToSpotifyLibrary() {
spotify := "ahk_exe spotify.exe"
if WinExist(spotify) {
; Store starting window ID and mouse position.
MouseGetPos x, y, startingWinId
; Activate Spotify.
WinActivate %spotify%
WinWaitActive %spotify%
saveToYourLibraryIcon = %A_WorkingDir%\apps\SpotifyController\SaveToYourLibraryIcon.png
ImageSearch FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %saveToYourLibraryIcon%
if (ErrorLevel = 0) {
Click %FoundX%, %FoundY%
} else if (ErrorLevel = 2) {
MsgBox % "Problem conducting image search. Is the saveToYourLibraryIcon in the correct location?"
} else if (ErrorLevel = 1) {
MsgBox % "Unable to save song. Can't find the Add button."
}
; Restore original window and mouse position.
WinActivate ahk_id %startingWinId%
MouseMove %x%, %y%
}
}
Instructions
If you've never created a script before please see the Beginner's Tutorial.
This uses the ImageSearch function. I created the image-to-find by taking a screenshot of the plus button in the bottom left corner of the Spotify app.
You can create one yourself or download this one.
Name it SaveToYourLibraryIcon.png
and place it in the same directory as your script.
That's it.
Press Ctrl+Shift+Win+F4
(change this to whatever you want) and the active song will be added to your library!
As of April 2018, Spotify's ahk_class is now reported as
Chrome_WidgetWin_1
. I updated this in the above but am still unable to get it to work. – Richard Fox – 2018-04-08T02:22:21.657Hi Richard. I updated to use the exe name instead of the window class. Give that a try. – GollyJer – 2018-04-23T15:17:36.933
Thanks, I found that the window height of the spotify window was being reported incorrectly though. I opted for this hack for the moment.
– Richard Fox – 2018-04-25T18:51:56.2531Richard, after testing a little bit I decided to remove the search area optimization section of the code. Even on a high resolution screen it's less than a second to save the song. Your code on github won't work if spotify isn't maximized. – GollyJer – 2018-04-27T20:52:28.320