Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-10-2018, 11:14 AM
|
#1
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
|
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.
|
|
|
02-10-2018, 12:48 PM
|
#2
|
LQ Newbie
Registered: Mar 2014
Location: France, Lille
Distribution: slackware-current
Posts: 23
Rep:
|
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.
|
02-10-2018, 12:51 PM
|
#3
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Original Poster
|
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.
|
|
|
02-10-2018, 01:20 PM
|
#4
|
LQ Newbie
Registered: Mar 2014
Location: France, Lille
Distribution: slackware-current
Posts: 23
Rep:
|
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.
|
02-10-2018, 01:24 PM
|
#5
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Original Poster
|
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.
|
|
|
02-10-2018, 02:28 PM
|
#6
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Original Poster
|
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.
|
03-28-2018, 05:39 AM
|
#7
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Original Poster
|
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.
|
|
|
03-28-2018, 06:13 AM
|
#8
|
LQ Guru
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,259
|
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.
|
03-28-2018, 12:46 PM
|
#9
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Original Poster
|
Quote:
Originally Posted by ponce
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
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.
|
|
2 members found this post helpful.
|
07-19-2018, 03:10 PM
|
#10
|
Senior Member
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Original Poster
|
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
|
|
|
04-28-2020, 08:05 PM
|
#11
|
LQ Newbie
Registered: Apr 2020
Distribution: Devuan, Ubuntu, OpenWRT
Posts: 6
Rep:
|
Quote:
Originally Posted by Lysander666
EDIT 2 -found it
Code:
amixer set Master 5%+
|
I confirm it works on my desktop Devuan ASCII.
Many thanks @Lysander666, you really helped me!
I listen radio broadcasting, live news etc via players that have their own shortcuts. But while other programs were on the screen, I had to use the mouse to conrtol the volume from the panel volume-icon.
With:
Code:
amixer set Master 5%+
amixer set Master 5%-
amixer set Master toggle
in 3 keyboard shortcuts (XFCE>Settings>Keyboard>Shortcuts>+Add) thinks are much easier, thanks again!
|
|
|
All times are GMT -5. The time now is 03:33 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|