I’m making much more of an effort lately to spend more time at home in Linux. I still have a Windows 7 drive because of gaming and some photography related applications I use, but aside from that, there’s no reason why I can’t “come home” to my Linux installation.
One issue I always seem to have is the fact that my two monitor setup includes one widescreen monitor (1920×1080) and one non-widescreen monitor (1280×1024), so one resolution never cuts it. Most of the modern Linux distributions can handle this with either the proprietary video drivers (like Nvidia), but with the various built-in drivers, it seems to be a roll of the dice as to whether or not the resolutions will work. I should also mention that I use the Qtile Window Manager because I like tiling managers, plus this one is written in Python, a language I’m trying to gain a lot of experience with. Anyway, Qtile has a very simplistic design, and that design excludes the normal “Menu” bar that has Applications, Settings, etc., which also forces me to learn more how to do things manually via the command line (another perk). This time, it’s adjusting my resolution.
When I first set up qtile, the monitors were in the wrong order — the left monitor was displayed as the right, and vice versa, so I’d have to move the mouse in the opposite direction to get the cursor to the other screen. Normally this isn’t an issue, I’d open the Gnome settings and switch them, but this time I got an error (perhaps due to my window manager and that I didn’t install Gnome, just pieces of it) so I had to find an alternate method. Enter xrandr. It was relatively quick to Google the correct command to switch my displays:
#This shows the current configuration as seen by xrandr: xrandr --current
This showed me the following (unimportant content truncated):
DVI-I-1 connected primary 1920x1080+1280+0 DVI-I-2 connected 1280x1024+0+0
So now I knew the tags for each of my monitors — the widescreen was DVI-I-1, and the other was DVI-I-2.
A glance at the usage (xrandr –help) showed me that there are some very intuitive parameters that can be passed, namely –right-of and –left-of. The following command switched my monitors as I desired:
xrandr --output DVI-I-1 --right-of DVI-I-2
So I added that to /etc/profile and restarted X to test (Control-Alt-Backspace) and it worked like a charm. There was one hitch though. Both monitors were using the resolution of the smaller one, and my 1920×1080 monitor was stretched and looked awful. Enter xrandr again. Making one minor edit to this command fixed me up for good!
xrandr --output DVI-I-1 --right-of DVI-I-2 --mode 1920x1080
So restarting X again showed me exactly what I was hoping for — proper resolution for each monitor. Chalk up another victory for Linux command line!