• ABOUT US
  • CONTACT US

I Love My Linux - A linux technology blog for penguins

  • blog
  • distributions
  • projects
  • contributors
Home › Blogs

Sam Morar's blog

Using multimedia keys in GDM

Sam Morar — Sun, 11/01/2009 - 21:31

Sam Morar's picture

I currently use MPD as my preferred media player, as it runs on my central machine, and I can easily control it from any other machine on our home network.

Now, occasionally, one wishes to just turn on the computer, and without logging in and doing all that admin, get some music playing / skip a song or two and adjust the volume to the correct settings.

The problem is that the first thing that loads up is GDM, which does not know what to do when you press one of the multimedia key on a multimedia keyboard.

Fortunately, this can be fixed easily using the accessibility framework built into GDM.

Edit the following lines in /etc/gdm/gdm.conf:

AddGtkModules=true
GtkModulesList=/usr/lib/gtk-2.0/modules/libkeymouselistener

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!!

  • gdm
  • howto
  • linux
  • mpd
  • multimedia keys
  • Tutorial
  • volume
  • Login to post comments

Say it isn't so

Sam Morar — Mon, 30/06/2008 - 14:57

Sam Morar's picture

Every two weeks, for the past 4 years, the award winning LugRadio team put out a podcast talking about the latest linux / oss news and having very colourful discussions about their very polarised views on all things linux.

They have even had live weekend events, which, at the time I wished I was able to attend, and am now very sad that I didn't.

Guys, the OSS community is going to miss you.

More info here and here.

  • humour
  • linux
  • lugradio
  • raccoons
  • 7 comments
Syndicate content

Search

Poll

LSB 4.0 just got released. Do you think the Linux Standards Base is a good idea?:

Tags

eee pc firefox freedom humour linux marketing microsoft open source Ubuntu windows
more tags

Recent comments

  • Re
    12 hours 17 min ago
  • Re
    16 hours 20 min ago
  • Re
    20 hours 17 min ago
  • Re
    1 week 3 days ago
  • Re
    1 week 4 days ago
  • Re
    1 week 6 days ago
  • Re
    2 weeks 58 min ago
  • Re
    2 weeks 1 hour ago
  • Re
    2 weeks 4 days ago
  • Re
    2 weeks 4 days ago

Recent blog posts

  • Fuzzy fonts in firefox 3.5?
  • Classic bash...
  • Off Topic - but so cool
  • HTC-Magic demo video
  • Thoughts on the HTC-Magic and Google Android
  • You Know You Want One.
  • watch this space...
  • Interesting read...
  • Does Dubya Know About This?
  • Ubuntu 9.04 Screen Switching Bullshit.
more

User login

  • Request new password
  • blog
  • distributions
  • projects
  • contributors