To enable multimedia keys on multimedia keyboards to control mpd from the GDM login screen, one can use the accessibility framework built into GDM.
Edit the following lines in /etc/gdm/gdm.conf:
Next, you need to add entries for each of your multimedia keys in /etc/gdm/modules/AccessKeyMouseEvents.
The entry format is as follows:
keycode num_keypresses keypress_duration timeout command command_args
Where, the command with it’s arguments is executed when the key given by keycode is depressed as many times as specified by the number of keypresses for longer than the keypress duration. Note, the command will be run as root, so be sure that it can’t do anything destructive!!
For example, my configuration which uses the mpc command to control the mpd daemon is as follows:
XF86AudioNext 1 0 1000 /usr/bin/mpc next
XF86AudioPrev 1 0 1000 /usr/bin/mpc prev
XF86AudioStop 1 0 1000 /usr/bin/mpc stop
XF86AudioPlay 1 0 1000 /usr/bin/mpc toggle
XF86AudioLowerVolume 1 0 1000 /usr/bin/mpc volume -2
XF86AudioRaiseVolume 1 0 1000 /usr/bin/mpc volume +2
XF86AudioMute 1 0 1000 /usr/bin/mpc volume 0
Then restart gdm by executing /etc/init.d/gdm restart
Voila, your multimedia keys should work in GDM!!