Problems with enabling multimedia-, volume- and brightness-keys in the i3 window manager with Macbook Air

i3keyboardmacintosh

I'm not able to make the multimedia-, volume- and brightness-keys to work in the i3 wm on my Macbook Air from 2015.
I have inserted the code which is supposed to enable the buttons however it doesn't work. Reloaded the config settings and tried restarting the computer. The following is the code I use:

Pulse Audio controls

bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +2%; exec pactl set-sink-mute @DEFAULT_SINK@ 0
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -2%; exec pactl set-sink-mute @DEFAULT_SINK@ 0
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle

Media player controls

bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

Sreen brightness controls

bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness

which I found on this question

Is it possible that the multimedia keys have a different name on certain Macbooks?

I have also tried this

Perhaps there is a significant place I have to place the code?

Edit 1

I can see the command line reacting when I press the buttons

Edit 2

When executing the xbacklight command in the prompt I get the following output:

% xbacklight -inc 20
No outputs have backlight property

Edit 3

I've now solved for the volume keys with the following rows

bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+
bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%-
bindsym XF86AudioMute exec amixer -D pulse set Master 1+ toggle

Edit 4

Found great info here: https://faq.i3wm.org/question/3747/enabling-multimedia-keys.1.html

Best Answer

This is an old question, but an answer may help out others. I ran into an issue upon a fresh installation of i3wm on my laptop where, for whatever reason, my XF86MonBrightnessUp/Down keys weren't being registered (I checked with xev). What I ended up doing is creating acpi actions and events which corresponded to the keys being pressed.

The following are the actions/events I defined in /etc/acpi/actions and /etc/acpi/events, respectively:

Actions

/etc/acpi/actions/bl-down.sh

#!/bin/sh

bl_device=/sys/class/backlight/acpi_video0/brightness
echo $(($(cat $bl_device)-1)) | sudo tee $bl_device

/etc/acpi/actions/bl-up.sh

#!/bin/sh

bl_device=/sys/class/backlight/acpi_video0/brightness
echo $(($(cat $bl_device)+1)) | sudo tee $bl_device

Events

/etc/acpi/events/bl-down

event=video/brightnessdown BRTDN 00000087 00000000
action=/etc/acpi/actions/bl-down.sh

/etc/acpi/events/bl-up

event=video/brightnessup BRTUP 00000086 00000000
action=/etc/acpi/actions/bl-up.sh

You can verify your brightnessup/down acpi event codes by using acpi_listen in your terminal and then pressing the relevant key combination (e.g., for me, it's Fn + Down Arrow for brightness down).

Finally, don't forget to restart acpid with sudo /etc/init.d/acpid reload

Note: Your backlight device may be defined in a different location than /sys/class/backlight/acpi_video0 - that's just where mine happened to be. Do some poking around.

Related Question