I just installed i3 window manager on ubuntu. This post serves as memory of what I did and learned.


The i3 window manager is a tiling window manager: it does away with the 3D “floating” window manager abstraction, where different windows can overlap and be dragged and dropped. Instead all windows are fully visible, and opening a new window will split either horizontally or vertically in half. This is very amenable to fast keyboard-based organization and navigation.


remap caps lock

I want to remap caps lock to escape. i3 does not load the keyboard settings from Unity, so I created the file ~/.Xmodmap with the lines

clear Lock
keysym Caps_Lock = Escape

and execute it on loading i3 by adding this to my ~/.i3/config: exec xmodmap ~/.Xmodmap

external monitor setup

I often work with an external monitor. Standard I want to detect if an external monitor is connected I want to disable my laptop monitor and auto-config the external monitor.

Script /usr/local/bin/setup-xrandr

if (xrandr | grep "VGA1 connected"); then
    xrandr --output LVDS1 --off --output VGA1 --auto
    if (xrandr | grep "HDMI1 connected"); then
        xrandr --output LVDS1 --off --output HDMI1 --auto
        xrandr --output VGA1 --off --output HDMI1 --off --output LVDS1 --auto
echo "setup-xrandr `date`" >> ~/.i3/log

Now I make a shorcut to execute setup-xrandr in .i3/config

bindsym $mod+Shift+X exec setup-xrandr

I tried to automatically execute it in ~/.i3/config by adding the line exec setup-xrandr - but that does execute at all. The last line of the script is used for checking when the setup-xrandr script is executed. Also, I want it to be loaded before when the display manager starts so I have a pretty login screen. I add the setup-xrandr to /etc/lightdm/lightdm.conf under SeatDefaults: display-setup-script=/usr/local/bin/setup-xrandr Now the script is nicely executed when logging in, but the login screen is in low-res with mirrorred screens still. I can live with this for now, but to be continued.

  • TODO executing setup-xrandr before the login screen is displayed. Add it to /etc/init/lightdm.conf ?
  • TODO why is the .i3/config command not executed but the xmodmap is?
  • TODO check out python-xrandr when switching to more complex dual monitor setup.

Setting python calculator shortcut

I tend to use python as a calculator and I want to be able to bring it up quickly in a floating window as not to change my current window lay-out. This does the trick (in my .i3/config).

bindsym $mod+Shift+P exec i3-sensible-terminal -e "ipython" --title="PYTHONCALC"
for_window [title="^PYTHONCALC$"] floating enable

Similar, I reserve Alt+Shift+T for a pop-up terminal.

bindsym $mod+Shift+T exec i3-sensible-terminal --title="TEMPTERM"
for_window [title="^TEMPTERM$"] floating enable

Other shortcuts, commands to remember, and aliases

  • using i3lock: bindsym Control+$mod+l exec i3lock -d -c 000020
  • suspending: alias susp='sudo pm-suspend && i3lock -c 000050'
  • Added startup applications:
    exec --no-startup-id nm-applet
    exec --no-startup-id dropbox start -i
  • alsamixer for command line sound control.
  • amixer vs pulse audio can conflict, on muting for example.
  • nmcli for command line network management.


Does not let me monitor CPU and mem usage. But since chrome is so memory hungry and I would be interested in a per-core load, I will look into py3status.


  • I installed i3 from the sur5r repo: https://i3wm.org/docs/repositories.html
  • Of course I changed the navigation to vim style navigation with hjkl.
  • No edge borders please! hide_edge_borders both
  • Hiding the title bar for chrome. I just want to have the tabs on top, nothing else. for_window [class="^Google-chrome$"] border 1pixel
  • switched to uxterm (I used terminator before, and before that gnome-terminal). Basically terminator was just a substitute for a tiling window manager. sudo update-alternatives --config x-terminal-emulator. Using solarized color scheme from https://github.com/solarized/xresources and set fonts using example from https://github.com/terryma/dotfiles/blob/master/.Xresources

X window system

I never delved into this so this is just a summary of what I learned. Please let me know if you see errors.

  • X provides the basic framework for interacting with the display, mouse and keyboard.
  • X11 is the protocol standard.
  • Xorg is the free implementation, branched off from XFree86.
  • At boot time, you either get a virtual console terminal (like on a raspberry pi) or a display manager is loaded on the X server console (ctrl+alt+F7).
  • In ubuntu the default display manager is lightdm.
  • A display manager starts the X servers, user sessions and login screen (greeter).
  • lightdm is configured in /etc/lightdm/lightdm.conf with simple things like default window manager.
  • The display manager checks /usr/share/xsessions/ to see which window managers / xsessions it has availble.
  • (TODO read more) If a display manager (lightdm) is used, ~/.xinitrc is not read. ~/.xinitrc is just used by startx. So to add logging for i3, I should probably edit the .desktop file in /usr/share/xsessions/