Most of the time I have the great program MPD running in the background, playing music that is independent of X running. I just fixed some small bindings for Gnome to integrate it more with MPD, and allowing direct control from your keyboard.
First, install “mpc”.
sudo apt-get install mpc
Then create a script called “~/.bin/mpcinfo”
In this script, write the following:
#!/bin/sh
mpc --format "[[%artist% - ]%title%]|[%file%]" | head -n2 | gmessage -timeout 5 -buttons "" -borderless -nofocus -wrap -geometry 500x20 -file -
Make it executable:
chmod +x ~/.bin/mpcinfo
Now launch gconf-editor
Go to apps->metacity->keybinding_commands
Edit the following values:
command_1: .bin/mpcinfo
command_2: mpc next
command_3: mpc previous
command_4: mpc toggle
Go to apps->metacity->global_commands
Edit the following values: (You can use whatever keybindings you want)
run_command_1: F12
run_command_2: Right
run_command_3: Left
run_command_4: Pause
Done! You don’t need to restart anything, Metacity will pick up your changes immediately.
Now try controlling mpd from your keyboard. Pressing “F12″ will popup a box for a few seconds that shows the current song, the Windows key + left/right moves to the previous/next song. Pressing the “Pause” key pauses or unpauses the music.
Enjoy!
One Comment
Hello!
Great hint, I developed it a little bit!
If you install libnotify and libnofity-bin, you could use it instead of gmessage so your popup is prettier
The command for mpcinfo would be something like (that’s the way it is in my computer):
notify-send “Music Player Daemon” “`mpc –format “%artist% – %title%\n%album%” | head -n2`”