Recently, I purchased a nice new Lenovo ThinkPad T460s. Naturally, I'm running Ubuntu on it and maintaining my new venture into using the i3 window manager. One problem that I ran into with this was when docking the ThinkPad at work. I wanted to use an external monitor that was plugged into the dock. Since i3 doesn't manage things like this for you, I had to hook into some events that know when the laptop has been docked and undocked and then use
xrandr to hook up the external monitor. This is how I managed to make it work. Albeit, with a few bugs...
First, you need to create a script that will handle your
xrandr commands. I called this script
manage-monitor.sh and I put it inside of