December 27, 2017 - rob
Change screen resolution on XFCE without a monitor
I have a headless PC at home that I remote into. Since it does not have a monitor, xfce does not allow me to change the screen resolution within VNC. I found a way to change this remotely though:
# First we need to get the modeline string for xrandr
# Luckily, the tool “gtf” will help you calculate it.
# All you have to do is to pass the resolution & the-
# refresh-rate as the command parameters:
gtf 1280 1024 60
Modeline “1280x1024_60.00” 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync
# In this case, the horizontal resolution is 1280px the
# vertical resolution is 1024px & refresh-rate is 60Hz.
# IMPORTANT: BE SURE THE MONITOR SUPPORTS THE RESOLUTION
# Typically, it outputs a line starting with “Modeline”
# e.g. “1280x1024_60.00” 172.80 1280 2040 2248 2576 1024 1081 1084 1118 -HSync +Vsync
# Copy this entire string (except for the starting “Modeline”)
# Now, use “xrandr” to make the system recognize a new
# display mode. Pass the copied string as the parameter
# to the –newmode option:
xrandr –newmode “1280x1024_60.00” 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync
# Then all you have to do is to add the new mode to the
# display you want to apply, like this:
xrandr –addmode DIN “1280x1024_60.00”
# DIN is the display name, it might differ for you.
# Run “xrandr” without any parameters to be sure.
# The last parameter is the mode-alias/name which
# you’ve set in the previous command (–newmode)
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 8192 x 8192
DIN disconnected primary 1280×1024+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
DVI-0 disconnected (normal left inverted right x axis y axis)
DVI-1 disconnected (normal left inverted right x axis y axis)
# It should add the new mode to the display & apply it.
# Usually unlikely, but if it doesn’t apply automatically
# then force it with this command:
xrandr –output DIN –mode “1280x1024_60.00”