LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-10-2018, 11:14 AM   #1
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Getting keyboard volume buttons to work in LXDE


I had a read of this topic:

https://www.linuxquestions.org/quest...ns-4175564374/

in order to get the keyboard volume buttons to work on Slack 14.2 32bit.

Now, first things first, I know the key binding is detected since xev shows me that pressing the volume key bindings gives

Code:
KeyRelease event, serial 48, synthetic NO, window 0x3600001,
    root 0x7e, subw 0x0, time 1134498, (659,79), root:(661,128),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 48, synthetic NO, window 0x3600001,
    root 0x7e, subw 0x0, time 1135209, (659,79), root:(661,128),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

though they don't seem to be work.

My soundcard is sink 0 according to

Code:
lysander@lysurfer_viii:~$ pamixer --list-sinks
Sinks:
0 "alsa_output.pci-0000_00_1b.0.analog-stereo" "Built-in Audio Analog Stereo"
so I input the following into the <keyboard> section of rc.xml:

Code:
  <keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
      <execute>pamixer --sink 0 -i 5</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioLowerVolume">
    <action name="Execute">
      <execute>pamixer --sink 0 -d 5</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioMute">
    <action name="Execute">
      <execute>pamixer --sink 0 -t</execute>
    </action>
  </keybind>
but it has had no effect. Does anyone know what I could be doing wrong?

Last edited by Lysander666; 02-10-2018 at 11:56 AM.
 
Old 02-10-2018, 12:48 PM   #2
suprateam
LQ Newbie
 
Registered: Mar 2014
Location: France, Lille
Distribution: slackware-current
Posts: 17

Rep: Reputation: Disabled
Hello,

Did you try manually the command in a terminal to make sure it works ?

I'm not using LXDE ( AwesomeWM ) but I do use the same method.
Here are the commands I'm using if it can help:

Code:
XF86AudioLowerVolume => "amixer -q sset PCM 2%-"
XF86AudioRaiseVolume => "amixer -q sset PCM 2%+,
XF86AudioMute => "amixer -q sset PCM toggle"
 
1 members found this post helpful.
Old 02-10-2018, 12:51 PM   #3
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348

Original Poster
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Hmm, when I try one of those I get:

Code:
bash: XF86AudioLowerVolume: command not found
So it recognises the binding through xev but not the command, which is interesting.
 
Old 02-10-2018, 01:20 PM   #4
suprateam
LQ Newbie
 
Registered: Mar 2014
Location: France, Lille
Distribution: slackware-current
Posts: 17

Rep: Reputation: Disabled
XF86AudioLowerVolume is not a command. It's just the `key` representation

what is the result of those command in a terminal ? does it increase/decrease the volume as expected ?
Code:
pamixer --sink 0 -d 5
or
Code:
pamixer --sink 0 -i 5
 
1 members found this post helpful.
Old 02-10-2018, 01:24 PM   #5
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348

Original Poster
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Yes - both of those work in lowering and raising the volume. So something is getting lost in applying the working command [e.g. pamixer --sink 0 -i 5] to the keys.
 
Old 02-10-2018, 02:28 PM   #6
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348

Original Poster
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Found it - the entry is:

Code:
 <keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
      <command>pamixer --sink 0 -i 5</command>
    </action>
  </keybind>
  <keybind key="XF86AudioLowerVolume">
    <action name="Execute">
      <command>pamixer --sink 0 -d 5</command>
    </action>
  </keybind>
  <keybind key="XF86AudioMute">
    <action name="Execute">
      <command>pamixer --sink 0 -t</command>
    </action>
  </keybind>
which has to be added to the <keyboard> section of .config/openbox/lxde-rc.xml - then logout and login.

The issue I had was that [as well as the slightly incorrect 'execute' tag] I was editing /etc/xdg/openbox/rc.xml directly, which should not be done.

Last edited by Lysander666; 02-10-2018 at 02:40 PM.
 
1 members found this post helpful.
Old 03-28-2018, 05:39 AM   #7
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348

Original Poster
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Sorry to resurrect this, but this function has stopped working for a while now, I can no longer use the keyboard buttons to adjust the audio volume. I have no idea what the issue could be. I wonder if it has anything to do with new packages that have been upgraded or installed, but since the file

.config/openbox/lxde-rc.xml

is unchanged I have no idea what such packages could be or why they could do so. Any suggestions would be most welcome.
 
Old 03-28-2018, 06:13 AM   #8
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 4,697

Rep: Reputation: Disabled
if you issue the same commands to which you have associated keys for in a terminal, do they have effect?
 
1 members found this post helpful.
Old 03-28-2018, 12:46 PM   #9
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348

Original Poster
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Quote:
Originally Posted by ponce View Post
if you issue the same commands to which you have associated keys for in a terminal, do they have effect?
Hmm, good idea. I'm just getting the response

Code:
Connection error
Wonder what could be causing that. I thought it could be because I enabled alsaequal/dmix, but I removed the code from .asoundrc and logged out/in, and I'm still getting the paerror.

EDIT: I did the following re another thread, this has definitely affected my link to PA

Quote:
1) Comment these lines in asound.conf:
Code:
pcm.default pulse
ctl.default pulse
2) Append these lines to /etc/pulse/default.pa:
Code:
load-module module-alsa-sink device=dmix
load-module module-alsa-source device=dsnoop
3) Keep this line in /etc/pulse/client.conf:
Code:
autospawn = yes
So I think I see what's going on here. I wonder if there's a way to directly raise/lower the volume via ALSA.

EDIT 2 -found it

Code:
amixer set Master 5%+
I imagine replacing the old code with this would work

EDIT 3 -and it does, thank you.

Seems on this system ALSA is the way for now rather than PA.

Last edited by Lysander666; 03-28-2018 at 01:05 PM.
 
1 members found this post helpful.
Old 07-19-2018, 03:10 PM   #10
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,348

Original Poster
Blog Entries: 3

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Appending for Xfce. This answer was very useful:

https://unix.stackexchange.com/quest...in-xfce/342555

Quote:
Right click a panel -> Panel submenu -> Add New Items...
Add an instance of PulseAudio Plugin
Right click the icon that just appeared in your panel and click "Properties". Make sure "Enable keyboard shortcuts for volume control" is enabled. -> See: Sound settings -> Audio mixer will tell you what package you use. If pulseadio is used the field should tell pavucontrol.
Open the configuration for your keyboard shortcuts and add the following commands:
pactl -- set-sink-volume 0 +10% # raise volume by each 10% (more than 100% possible, might distort the sound)
pactl -- set-sink-volume 0 -10% # reduce volume by each 10%
pactl -- set-sink-mute 0 toggle # mute/unmutes audio

Config for keyboard shortcuts in Xfce = settings > keyboard > shortcuts

Notice the difference between pavu and alsa in the answer which accounts for my volume stopping working initally in LXDE since I have disabled access to Pulse in my other Slack install. Hopefully someone will find this useful.

Last edited by Lysander666; 07-19-2018 at 03:11 PM. Reason: added Xfce
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command buttons for HP keyboard to work for Ubuntu curioslinux Linux - Newbie 1 10-16-2012 12:14 AM
Cant get volume buttons and digital card reader to work IronFox Fedora 3 10-12-2007 03:13 PM
Volume buttons kill keyboard.. CHambeRFienD Ubuntu 0 10-16-2005 12:41 AM
mute/volume buttons to work? microsoft/linux Linux - Laptop and Netbook 7 08-20-2005 02:35 PM
Any progs to make keyboard buttons work? Jmcatch742 Linux - Software 1 12-30-2004 02:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration