i3 window manager on laptops: my configuration

In a previous post I’ve explained the setup of my “ultra geek” laptop: a cheap Dell with Debian, a minimal graphical interface (i3) and a small subset of light applications.

Some readers asked me more information about my i3 configuration, expecially regarding some laptop features such as keys binding for screen brightness and volume control.

Power management

In my configuration i don’t use any external power management tool/applet (like the most used xfce4-power-manager): the brightness keys of my Dell works also without any software.
In other laptops, i use a simple script that writes directly on /sys/class/backlight.

In order to rebind the power button, a small change on systemd configuration is required.

In /etc/systemd/logind.conf, set the HandlePowerKey to ignore, HandleLidSwitch to suspend and restart systemd-logind.

Now, pressing power button doesen’t triggers system shutdown, that allows to rebind the key in i3 configuration. Further, closing the lid put the system in sleep.

So, now you can map power button in i3 config:

set $mode_power [l]ogoff | [s]hutdown
mode "$mode_power" {
        bindsym l exec i3-msg exit
        bindsym s exec systemctl poweroff
        bindsym Return mode "default"
        bindsym Escape mode "default"
}
bindsym --release XF86PowerOff mode "$mode_power"

Audio management

More simple! Without any other plugin/applet, you can rebind volume control keys in i3 configuration file:

bindsym XF86AudioRaiseVolume exec ~/.bin/volume.sh up
bindsym XF86AudioLowerVolume exec ~/.bin/volume.sh down
bindsym XF86AudioMute exec ~/.bin/volume.sh mute 

volume.sh is a simple script that change audio levels using amixer:

Finally, with a little change on i3status.conf you can show audio level on status bar:

volume master {
format = "♪:%volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
# and
order += "volume_master"

References


Related posts

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.