You are not logged in.

#1 2013-06-13 13:08:00

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

sound buttons, that keep screen idle if so

What I want to achieve is, use the audio buttons without activating(if idle) the display.
Often the laptop plays only music for a while, I find it annoying if the screen wakes, if I press the volume, pause etc. buttons!
I have been trying to understand how I should go about with this one, but I need a little help.
It's all about the next buttons in xbindkeys

# Increase volume
"amixer set Master playback 1+"
    m:0x0 + c:123
    XF86AudioRaiseVolume

# Decrease volume
"amixer set Master playback 1-"
    m:0x0 + c:122
    XF86AudioLowerVolume

# Toggle mute
"amixer set Master toggle"
    m:0x0 + c:121
    XF86AudioMute
    
# Toggle play/pause
"deadbeef --play-pause"
    m:0x0 + c:172
    XF86AudioPlay
    
# Toggle stop
"deadbeef --stop"
    m:0x0 + c:174
    XF86AudioStop
    
# Toggle next
"deadbeef --next"
    m:0x0 + c:171
    XF86AudioNext
    
# Toggle prev
"deadbeef --prev"
    m:0x0 + c:173
    XF86AudioPrev

So the idea is to do as folows;

# Increase volume
"/usr/local/bin/idle-display-button "
    m:0x0 + c:123
    XF86AudioRaiseVolume

Then use a script to address the "amixer set Master playback 1+", and the other buttons...
Now I have 6 buttons, can they all point at the same script, how do I let every button go directly to a specific part in the script, with $1, $2 at the end?

The next one is a little harder, but how do I poll if the screen is idle, and if so how do I keep it like that, as standard the display wakes on key input!
I read about DPMS, and I think I can use that in the script, but how?

I don't need the solution, I like to try that myself, but, If anyone has a few tips for me, that would be great;)

Offline

#2 2013-06-13 15:12:45

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: sound buttons, that keep screen idle if so

qinohe wrote:

Now I have 6 buttons, can they all point at the same script, how do I let every button go directly to a specific part in the script, with $1, $2 at the end?

You can call your script like "/path/to/button-script BTN" and replace BTN with a unique identifier for each button. Inside button-script you check the content of $1 and perform the required action.

The next one is a little harder, but how do I poll if the screen is idle, and if so how do I keep it like that, as standard the display wakes on key input!

I don't think there is an easy way to change that, but I thought about a few workarounds:

  • use "xset s activate" in your script to blank the display again

  • just completely turn of your display with vbetool

  • try using a remote control for changing the volume etc

I don't know if the remote would help you since I've never used one myself, but if you have one anyway you could give it a try.

Offline

#3 2013-06-13 17:35:25

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: sound buttons, that keep screen idle if so

cookies wrote:

You can call your script like "/path/to/button-script BTN" and replace BTN with a unique identifier for each button. Inside button-script you check the content of $1 and perform the required action.

I thought it would work like that but couldn't find a reference, thats gonna work then!

I don't think there is an easy way to change that, but I thought about a few workarounds:

  • use "xset s activate" in your script to blank the display again

  • just completely turn of your display with vbetool

  • try using a remote control for changing the volume etc

I don't know if the remote would help you since I've never used one myself, but if you have one anyway you could give it a try.

I don't have a remote, so cant test it, but don't they use the same 'keys', like 'XF86AudioRaiseVolume', and thus enabling the display!?
I like the workarounds, but it's not what I want, these audio buttons shouldn't touch the screen in the first place!, they are for sound!
Maybe someone disagrees with me, but thats how I would like to have it!
And since it don't work that way, I try to create it;)

Offline

#4 2013-06-13 19:13:36

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: sound buttons, that keep screen idle if so

The X server is monitoring for keypresses to know when to turn the screen back on, it doesn't care what key is pressed.
You can see if not including the multimedia keys in your window manager at build time will help(comment the line that looks like #include <X11/XF86keysym.h>) but then you need some way to make those keys work, maybe bind or something.
Might be easier to look at just having a tty open and playing the music from there.


You're just jealous because the voices only talk to me.

Offline

#5 2013-06-13 20:07:59

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: sound buttons, that keep screen idle if so

qinohe wrote:

I don't have a remote, so cant test it, but don't they use the same 'keys', like 'XF86AudioRaiseVolume', and thus enabling the display!?

According to the wiki, some should do that and some might not.

There's another crazy little idea, in case you've got a smartphone (or something similar). You could install mpd on your laptop and use your smartphone to control mpd over the local network. That would be a cool trick to impress your friends big_smile

Offline

#6 2013-06-13 20:21:03

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: sound buttons, that keep screen idle if so

moetunes wrote:

The X server is monitoring for keypresses to know when to turn the screen back on, it doesn't care what key is pressed.

So, X server is taking care of this itself, I should have thought of this.

You can see if not including the multimedia keys in your window manager at build time will help(comment the line that looks like #include <X11/XF86keysym.h>) but then you need some way to make those keys work, maybe bind or something.

Ah so it should be possible to do, I use xbindkeys, but I guess you mean something like bind '"\e[24~": amixer set Master playback 1-' this is F12 btw.)
Well, gonna be a real search then, as I just used 'read' to try the volume, play/pause etc. ... they don't give output!(

Might be easier to look at just having a tty open and playing the music from there.

? You mean like playing moc in another tty, than a button press will still enable the screen, no?

Offline

#7 2013-06-13 20:31:08

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: sound buttons, that keep screen idle if so

cookies wrote:

According to the wiki, some should do that and some might not.

There's another crazy little idea, in case you've got a smartphone (or something similar). You could install mpd on your laptop and use your smartphone to control mpd over the local network. That would be a cool trick to impress your friends

Oh sorry I overlooked your post, I do have one, and played with that and a firefly server, it ran on Freenas, as I recall!
Yes that is also a possibility, I will look into that too! Well, I don't need to impress my friends,  but thanks wink

Offline

Board footer

Powered by FluxBB