You are not logged in.

#1 2010-03-27 08:35:35

falsum
Member
From: Calgary - Canada
Registered: 2010-03-04
Posts: 38

[SOLVED] mplayer, xF86 media keys

Hi,

mplayer is my software of choice for playing music. That's what I would like to do with it: bind some of the xF86 keys to move to the next/previous music -- instead of going to the terminal where mplayer is originally running and use the keys < / > to move between tracks.

However, after some search, I couldn't find a script/command that I could bind to the xF86 keys that allows me to do this. Is there such a command I could use?

Thanks!!

p.s.: since xmonad is my windows manager, I'm using the xmonad configuration file to bind my media keys.

Last edited by falsum (2010-05-08 09:20:48)

Offline

#2 2010-03-27 10:28:54

snakebite
Member
From: Norway
Registered: 2009-05-13
Posts: 42

Re: [SOLVED] mplayer, xF86 media keys

If xmonad lets you run commands on key bindings you can set up an input pipe to mplayer (put input=file=/home/<username>/.mplayer/pipe in your .mplayer/config) and echo commands to that pipe (see mplayer -input cmdlist for the command list). I think pt_step is the command you want here (google).

Offline

#3 2010-03-27 10:50:26

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] mplayer, xF86 media keys

Create a pipe

mkfifo mplayer.pipe

start mplayer like so

mplayer -slave -input file=mplayer.pipe

now you can send commands to this fifo, for example:

echo "pt_step 1" > mplayer.pipe
echo "pt_step -1" > mplayer.pipe

for next song/previous song.

Edit: Gah, beaten by snakebite. The dangers of multi-tasking. Oh well...

Last edited by Gusar (2010-03-27 10:52:12)

Offline

#4 2010-03-27 23:46:07

falsum
Member
From: Calgary - Canada
Registered: 2010-03-04
Posts: 38

Re: [SOLVED] mplayer, xF86 media keys

Thanks very much for the replies. But for some reason I couldn't get it working though...

Following Gusar's suggestion, I tried to use the command "echo "pt_step 1" > mplayer.pipe " but it didn't work. When I type this command on the command line it hangs without doing anything.

Any ideas of how I can solve this problem?

Thanks!

Offline

#5 2010-03-28 00:13:29

falsum
Member
From: Calgary - Canada
Registered: 2010-03-04
Posts: 38

Re: [SOLVED] mplayer, xF86 media keys

Hi again,

I got it working. I've changed something that I though you wouldn't matter: instead of using tilde (~) to indicate the path of mplayer.fifo I used the absolute path. Now it works like a charm.

Do you know why this change matters?

Cheers,

Offline

#6 2010-03-28 01:52:42

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: [SOLVED] mplayer, xF86 media keys

falsum wrote:

I got it working. I've changed something that I though you wouldn't matter: instead of using tilde (~) to indicate the path of mplayer.fifo I used the absolute path. Now it works like a charm.

Do you know why this change matters?

It's because of how bash/<insert shell here> handles tildes.

$ echo ~
/home/you
$ foo=~
$ echo $foo
/home/you
$ foo=bar=~
$ echo $foo
bar=~

This trips many people up.

Offline

#7 2010-04-23 06:23:39

josh000
Member
Registered: 2010-04-05
Posts: 37

Re: [SOLVED] mplayer, xF86 media keys

This isn't exactly related but I thought it may be better than making a new thread.

Is there a way to remap the keys in mplayer? I would like doule click to be full screen and one click to be pause...is there a way to do this?

Offline

#8 2010-04-23 08:50:41

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] mplayer, xF86 media keys

josh000 wrote:

Is there a way to remap the keys in mplayer? I would like doule click to be full screen and one click to be pause...is there a way to do this?

Sure. The file is ~/.mplayer/input.conf
For what you want:

MOUSE_BTN0 pause
MOUSE_BTN0_DBL vo_fullscreen

All commands that you see when you type 'mplayer -input cmdlist' can be configured in input.conf to either the mouse or the keyboard.

Offline

Board footer

Powered by FluxBB