You are not logged in.

#1 2006-05-11 10:46:39

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

bash script that does play/pause to gnome apps

Recently I got myself a new keyboard which has a few media buttons on it. To my surprise, they worked out of the box under gnome (for some reason KDE doesn't catch the keys under the keyboard shortcut section, but gnome was more or less pre configured :?). For example, there is a play/pause button on the keyboard, and whenever I press it my audio program, whether it is listen, rhythmbox, or totem, pauses - just like magic.

Now, I've been fiddling around a little with bluemote, and would like to write a simple bash script that does precisely what that play/pause button does, so that I can call it via bluemote. But I have no clue of how to do that. I know KDE has the whole dcop thing, but isn't there anything similar for gnome?

Offline

#2 2006-05-11 11:52:30

FUBAR
Member
From: Belgium
Registered: 2004-12-08
Posts: 1,029
Website

Re: bash script that does play/pause to gnome apps

I've been screwing around with those multimedia keys aswell. There's a tool (I can't remember the name) that catches the keycodes (if any). Then you can combine the keycode with a special action, like "mpc next" and the action is executed when you press the button.

I wish I still knew the names of those programs. What you could do, though, is find out the keycodes and then connect each one with a simple script (nextsong.sh or something) that checks which music player is playing and then issues the correct command.

I think that would work for any WM/DE and even without X.


A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.

Offline

#3 2006-05-11 12:16:30

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: bash script that does play/pause to gnome apps

xev to get keycodes, xbindkeys can automatically grab keycodes and bind them.

grab xbindkeys_config for an easy xbindkeys config tool.

James

Offline

#4 2006-05-11 12:26:23

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: bash script that does play/pause to gnome apps

thanks. i'll look into this.

Offline

#5 2006-05-11 14:15:07

sebcactus
Member
From: Germany
Registered: 2005-01-27
Posts: 277

Re: bash script that does play/pause to gnome apps

Maybe something like lineakd might be even easier.

Offline

Board footer

Powered by FluxBB