dwl setting up volume keys on freebsd with the mixer command


setting up the media volume keys on the dwl wayland tiling window manager
using the mixer command to raise, lower and mute the volume

update you dont need to import the xf86 header, dwl already imports a version we can use
updated code

Code:
/* commands */
static const char *volumeup[]      = { "/usr/sbin/mixer",   "vol=+5%:+5%",  NULL };
static const char *volumedown[]    = { "/usr/sbin/mixer",   "vol=-5%:-5%",  NULL };
static const char *mutevolume[]    = { "/usr/sbin/mixer",   "vol.mute=^",        NULL };

static const Key keys[] = {
    /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
    /* modifier                  key                 function        argument */

    { 0,                         XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volumeup   } },
    { 0,                         XKB_KEY_XF86AudioLowerVolume, spawn, {.v = volumedown } },
    { 0,                         XKB_KEY_XF86AudioMute, spawn, {.v = mutevolume } },

github notes

dwl config files - just the modified files

volume control gist
 
Last edited:
Back
Top