How to use laptop function keys in Archbang
Archbang is a Linux distro based of Arch Linux. It brings the full Arch Linux experience to users without the cumbersome installing process of Arch Linux. Archbang is very lightweight, fast and stable and usually works well out of the box. However, unlike with Ubuntu or LinuxMint, if you install Archbang on a laptop, you need to do some editing to make the laptop function keys work. This article will show you how.
To make the function keys work, you just need to edit the config file of openbox and assign an appropriate command for each key. First, you need to find the name of the function keys of your laptop. To do so, you need the xorg-xev package. Just open the terminal and run this command to install xorg-xev:
sudo pacman -S xorg-xev
After that, you need to run the following command:
xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
You will see a white window with a black square inside will appear. To find the name of a key, just move the cursor to the white window then hit the key,the name of the key will appear on the terminal. Here is an output sample:
10 ampersand
24 a
127 Pause
133 Super_L
133 Super_L
213 XF86Suspend
233 XF86MonBrightnessUp
86 KP_Add
82 KP_Subtract
111 Up
84 KP_Begin
85 KP_Right
77 Num_Lock
89 KP_3
Now you know the name of the function keys of your laptop, to make them work with Archbangn you need to edit the config file of Openbox. The config file for a local user will be ~/.config/openbox/rc.xml. Use leafpad to open the file and search for <keyboard> , this is where you edit the keybindings in Openbox.
Here is an example in which I use the MonBrightnessUP key to increase the brightness of my laptop screen:
<keybind key="XF86MonBrightnessUp"">
<action name="Execute">
<command>xbacklight +20</command>
<startupnotify>
<enabled>yes</enabled>
<name>Increase screen brightness</name>
</startupnotify>
</action>
</keybind>
Here are some common commands you may need to assign to the function keys:
- To shutdown your laptop:
sudo shutdown -h now
- To reset:
sudo reboot
- To increase/decrease audio volume:
amixer set Master 3%+
Note: change the percentage to your preference, use the minus symbol (-) instead of the plus one (+) to decrease audio volume.
- To mute/unmute audio:
amixer set Master toggle
- To incease/decrease screen brightness:
xbacklight +20
Note: change the number to your preference, use the minus symbol (-) to decrease the brightness
