Spotifycmd is a command line tool (which even though is called "spotify_cmd.exe", is actually a Linux binary) that can control a running instance of Spotify (in Wine). It can play, pause or stop the current playing track, go to the previous / next track and display the Spotify status (playing artist / song) - but we don't need this last part since we have Spotify-Notify.
Here are the exact Spotifycmd supported commands:
- Play/pause playback: ./spotify_cmd.exe playpause
- Stop playback: ./spotify_cmd.exe stop
- Next track: ./spotify_cmd.exe next
- Previous track: ./spotify_cmd.exe prev
- Artist and track information: ./spotify_cmd.exe status
The Spotifycmd also says that it works for volume up/down and mute, but that didn't work for me (Ubuntu 10.10, latest Spotify). Still, that shouldn't be an issue since you can already control the global sound of your desktop using keyboard shortcuts so the only real issue with Spotify is using keyboard shortcuts for next/previous track and play/pause.
To set up keyboard shortcuts for controlling Spotify, download Spotifycmd and extract it somewhere (like for instance in your home folder), then (in Gnome, I'm not sure about other desktop environments), go to System > Preferences > Keyboard Shortcuts and click "Add", and to set up a "next track" Spotify keyboard shortcut, under name enter whatever you want (like "SpotyNext") and under the "Command" field, enter this:
Where /path/to/ is the exact path to the folder where you've extracted Spotifycmd. Then click "Apply and you'll then be able to assign a keyboard shortcut for your custom command.
You'll have to repeat the process for every custom keyboard shortcut you want to asign for Spotifycmd (previous track, playpause and stop).