This is a script created to control a running Spotify instance on linux from the command line. The script uses wmctrl and xvkbd. The reason for the creation of this script is to get global shortcuts for Spotify on linux. To use this script on *buntu you need to have xvkbd and wmctrl installed, which can be done with the following command: sudo aptitude install wmctrl xvkbd.
Keys can be bound to the different script calls in KDE by using the start menu editor. Every start menu item, can have its own global shortcut. So by adding three entries for play/pause, next and previous song in the start menu, we can bind shortcuts to these in the advanced tab of the menu item.
If you want to use the script, for example over ssh, you have to use the DISPLAY variable. This can be normally made in bash shell by commanding: EXPORT DISPLAY=:0.0 before calling the script.