Skip to content
James Won edited this page Apr 23, 2020 · 1 revision

Intro

I currently have a Lenovo Thinkpad X1 Carbon Gen 6 and I wanted to document my process of getting i3 working and setup on a fresh install of an Ubuntu-based distro.

I am currently using i3 on Ubuntu 20.04, but these instructions should work on any Ubuntu-based distro.

I am assuming you are using the i3 config in my dotfiles repo here: https://github.com/jwon/dotfiles/blob/master/i3/.config/i3/config

HiDPI Support

The X1 Carbon has a HiDPI screen and that doesn't bode well with i3's initial setup. Everything looks tiny.

Quick and easy fix can be found here: https://dougie.io/linux/hidpi-retina-i3wm/

Basically, there's two things you need to do. First, create/edit ~/.Xresources and add the following:

Xft.dpi: 192
URxvt.font: xft:FiraMono-Regular:size=10
Xft.autohint: 0
Xft.lcdfilter:  lcddefault
Xft.hintstyle:  hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

Secondly, create/edit ~/.profile and add the following:

export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
export QT_AUTO_SCREEN_SCALE_FACTOR=1

Reboot and things should look much better.

Screen backlight Fn keys

Even if you use my i3 config that has the mappings for the keyboard Fn keys to adjust the screen backlight, it won't work out of the box. There are two things that need to be done.

Firstly, make sure you have xbacklight installed:

sudo apt install xbacklight

Secondly, see if xbacklight works (it doesn't out of the box on my Pop! OS 19.10 installation):

$ xbacklight
No outputs have backlight property

If you get the output above, you need to tweak your Xorg config to get xbacklight to work correctly.

To fix, open up /etc/X11/xorg.conf (create one if it doesn't exist), and add the following:

Section "Device"
    Identifier  "Device0"
    Driver      "intel"
    Option      "Backlight"  "intel_backlight"
EndSection

The Device0 part is arbitrary. It can be anything you want.

You also need to do with with sudo or as root.

Once you save those changes, reboot, then try running xbacklight again. It should work!

$ xbacklight
39.339623
$ xbacklight -inc 5
$ xbacklight       
44.339623
$ xbacklight -dec 10
$ 34.339623

Also test out the Fn keys on your keyboard for screen brightness, they should work as well!

You might get suggestions searching online to use xrandr instead of xbacklight to get this to work. xrandr will work, however, it is changing software-based screen brightness rather than changing the hardware brightness.

External monitor / dock setup

I want i3 to automatically detect when a display is plugged in and load the appropriate xrandr config including display layout, etc.

I believe the best way to do this is to use autorandr. Instructions here: https://github.com/phillipberndt/autorandr/

In essence though, you want to:

sudo apt install autorandr

Setup your display layout with nothing plugged in (just using your laptop screen) and run:

autorandr --save laptop

Then plug in your dock and/or external monitor and get your display layout just the way you want it. I like using arandr for this.

Once everything is setup the way you want it, run:

autorandr --save docked

At this point, autorandr should take care of changing the display layout any time you hot plug the display device. You can check which layout is currently applied by running autorandr. Example:

$ autorandr
laptop
docked (detected) (current)

Clone this wiki locally