Anyone know how to setup XF86 keys below with dkwm.
XF86AudioMute
XF86AudioLowerVolume
XF86AudioRaiseVolume
Thanks
Anyone know how to setup XF86 keys below with dkwm.
XF86AudioMute
XF86AudioLowerVolume
XF86AudioRaiseVolume
Thanks
@chroot - Where did you get that example? Looks like setup for dwm.
@KoO -
I just have them in the sxhkdrc file:
XF86AudioRaiseVolume
pamixer -i 5
XF86AudioLowerVolume
pamixer -d 5
XF86AudioMute
pamixer -t
For pamixer and pulseaudio.
LOL, read as dwm.
Thanks PackRat Works a treat.
Thanks for this!
This will put an end to my fiddling with volume in systray!!
womp
No problem.
And I will exercise some moderator super powers and re-post the information @chroot posted since it’s an excellent example. This is code to get your multimedia keys working in dwm. It also applies to player control, brightness, browser, mail erc … keys:
#include <X11/XF86keysym.h>
/* Add somewhere in your constants definition section */
static const char *upvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "+5%", NULL };
static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "-5%", NULL };
static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute", "0", "toggle", NULL };
/* If you use amixer, use this instead. Thanks go to DaniOrt3ga. */
static const char *upvol[] = { "/usr/bin/amixer", "set", "Master", "5%+", NULL };
static const char *downvol[] = { "/usr/bin/amixer", "set", "Master", "5%-", NULL };
static const char *mutevol[] = { "/usr/bin/amixerl", "set", "Master", "toggle", NULL };
/* To use light add this to the constant definition section. Thanks Hritik14. */
static const char *light_up[] = {"/usr/bin/light", "-A", "5", NULL};
static const char *light_down[] = {"/usr/bin/light", "-U", "5", NULL};
/* Add to keys[] array. With 0 as modifier, you are able to use the keys directly. */
static Key keys[] = {
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvol } }
{ 0, XF86XK_AudioMute, spawn, {.v = mutevol } }
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } }
};
/* If you have a small laptop keyboard or don't want to spring your fingers too far away. */
static Key keys[] = {
{ MODKEY, XK_F11, spawn, {.v = downvol } },
{ MODKEY, XK_F9, spawn, {.v = mutevol } },
{ MODKEY, XK_F12, spawn, {.v = upvol } },
};
/* To use light add this to the keys[] array. Thanks Hritik14. */
static Key keys[] = {
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = light_up} },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = light_down} },
};
Note that you have to include the XF86keysym.h file, then define the functions, and finally define the keybindings. Put this code in your config.def.h (or config.h) then (re)-compile dwm.
Adjust the functions for your particular system.
Great!!
womp
Thanks for this PackRat
dkwm
If anyone wants to run media keys on non-systemd or runit like Void, you need to change XF86Audio command.
# Media volume controls
XF86AudioRaiseVolume
amixer -q sset Master,0 1+ unmute
XF86AudioLowerVolume
amixer -q sset Master,0 1- unmute
XF86AudioMute
amixer -q sset Master,0 toggle
As per PackRat DWM
Thanks again.
As i’m running full alsa now I had to change the XF86 command. for alsa only without pulse installed.
XF86AudioRaiseVolume
amixer set Master 5%+
XF86AudioLowerVolume
amixer set Master 5%-
XF86AudioMute
amixer set Master toggle