4/22/2016

Setting Screen Resolution In Linux

While Linux distros these days usually provide a graphical tool to manage screen resolution, there are times where the settings need to be set manually.  This can occur if the GUI tool fails to apply settings or cannot probe the monitor's resolution, if you want to use a non-standard resolution, or if you wanted to set the resolution via a script.

I often have to resort to this method when launching Ubuntu in VMware Workstation because the virtual machine library list on the left of my panel results in a funky max resolution for my VMs of 1712x935.  The example below will use this resolution.

To set the resolution, we'll be using the X11 tools xrandr and cvt.  First, we'll need to determine the name for our display, using xrandr's query flag.
xrandr -q
Output of xrandr's query, showing the display (monitor) name.


We will also need to get the modeline settings for our desired resolution and refresh rate.  In the command below, the numbers are the screen's desired horizontal pixel count, vertical pixel count, and refresh rate.  Finding my preferred resolution was the lengthiest portion of this entire process for me, mainly due to my OCD requiring multiple tests to find the "perfect" setting.  Do not get discouraged, trial and error is your friend on this step.
cvt 1712 935 60
cvt 1712 935 60
Copy the Modeline value starting at the first double quote, you'll need this for the next step.

Make note of the output from the cvt command above.  Copy the modeline values, starting with the double quoted resolution/refresh rate to the end of the line, and use it to create a newmode in xrandr.
xrandr --newmode "1712x935_60.00" 132.00 1712 1816 1992 2272 935 938 948 971 -hsync +vsync
Lastly, add the newly created mode to the screen using the name from the first command, then set this screen to use this same output mode.
xrandr --addmode Virtual1 1712x935_60.00
xrandr --output Virtual1 --mode 1712x935_60.00


MacOS Tweaking 101

Is your beloved hunk of Cupertino silicon underperforming?  Wish your Mac had a little more zip?  Then you'll love these tips on squeez...