I’ve been running dual monitors on Ubuntu for a while now. It’s much nicer than a single monitor in terms of enabling higher productivity, however it can produce quirky behavior in some specific situations. One such situation occurs when trying to run a full screen game that only wants to use one monitor, yet I’ve got two enabled. Most games handle this properly and disable the second monitor themselves, but there are a select few that either fail to run at all or run at greatly reduced performance. These problems can be remedied simply by disabling the second monitor ahead of time using xrandr. I’ve written a script to take care of this, place the following code at the bottom of your .bashrc file in your home directory.

1
2
3
4
5
6
7
gamemode() {
	if [ $1 == 1 ]; then
		xrandr -s 1920x1080 #Only use one monitor for games
	elif [ $1 == 0 ]; then
		xrandr -s 3200x1080 #back to dual screen glory!
	fi
}

Edit the xrandr commands to reflect your own desired screen setup. Each setting can then be easily invoked by typing in the terminal “gamemode 1” to enable or “gamemode 0” to disable.