How to Force Screen/s Resolution in Ubuntu and Make It Permanent

How to force screen/s resolution in Ubuntu and make it permanent
by Janeth Kent Date: 09-11-2016 ubuntu screen resolution xrandr linux

Sometimes our ubuntu drivers don't work so well as we espect with our screens, most of the time we get a low resolution in our screens and cannot change it via GUI, fortunately using xrandr we can easily configure our screens to force them to a better resolution.

First of all, get the screens active in your pc:

$ xrandr 
Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
   1600x900       60.0*+
   1440x900       59.9  
   1360x768       59.8     60.0  
   1152x864       60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1280x1024      75.0     60.0  
   1152x864       75.0  
   1280x720       60.0     50.0     59.9  
   1024x768       75.1     60.0  
   800x600        75.0     60.3  
   720x576        50.0  
   720x480        60.0     59.9  
   640x480        75.0     60.0     59.9  
   720x400        70.1  
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Let's create a new resolution using cvt

$ cvt 1368 768 60
1368x768 60.89 Hz (CVT 1.44M9) hsync: 70.55 kHz; pclk: 151.25 MHz
Modeline "1368x768_60.00"  85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync

Now we Add a new mode to the existing list (newmode is the name and remaining portion is )

$ sudo xrandr --newmode "1368x768_60.00"  85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync

What we do now it's to find the current display/s

$ xrandr | grep -e " connected [^(]" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/"

Add new display mode where is the output from the previous command

$ sudo xrandr --addmode VGA-0 1368x768_60.00

This will add the new resolution to your existing list of supported resolutions. You can then choose the right option from the "display settings" or following command

$ xrandr --output VGA-0 --mode "1368x768_60.00"

To make this change permanent,

$ cat> ~/.xprofile
sudo xrandr --newmode "1368x768_60.00"  85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
sudo xrandr --addmode VGA-0 1368x768_60.00
xrandr --output VGA-0 --mode "1368x768_60.00"

edit the file /usr/sbin/lightdm-sessionand add the xrandr configuration after the # Load profile section

Here is how the part of that file looks now:

# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
  if [ -f  "$file" ]; then
     echo "Loading profile from $file";
     . "$file"

xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode VGA-0 1368x768_60.00
xrandr --output VGA-0 --mode 1368x768_60.00

# Load resources

Take note that the Xrandr settings should be changed to match yours, so before check your screen/s with the initial command

by Janeth Kent Date: 09-11-2016 ubuntu screen resolution xrandr linux hits : 29133  
Janeth Kent

Janeth Kent

Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN END DEVELOPMENT.


Related Posts

Linux For Dummies: Permissions

In the previous articles I made a short introduction to the Unix world and in the following article I have dealt with the basic commands for the file system management. Today we are…

Linux for Dummies: Ubuntu Terminal

I introduced in the previous article, available here, the basic concepts concerning the Linux world. Today we are going to have a look to some basic operations that we can perform…

The Best RSS Readers for Ubuntu

Even if most of the tech experts actively claim that RSS (Rich Site Summary) is dead especially after Google Reader was discontinued 5 years ago but it isn’t yet as…

How to install Letsencrypt Certificates with Certbot in Ubuntu

In this article we will explain how to install, manage and configure the SSL Security certificate, Let's Encypt in NGINX server used as proxy. This certificate is free but does…

How to Set up a Fully Functional Mail Server on Ubuntu 16.04 with iRedMail

Setting up your own mail server from scratch on Linux is complex and tedious, until you meet iRedMail. This tutorial is going to show you how you can easily and…

GIMP 2.10 released: Features 32-bit support, new UI and A Ton Of Improvements

It's been over a half-decade since the GIMP 2.8 stable debut and today marks the long-awaited release of GIMP 2.10, its first major update in six years. And among other…

Setting Up SFTP on Ubuntu 16.04

I recently had a request to setup SFTP for a customer so they could manage a set of files in their environment through an FTP GUI. Being an avid user…

Install Java in Ubuntu 16.04

Java and the JVM (Java's virtual machine) are widely used and required for many kinds of software. This article will guide you through the process of installing and managing different…

ArangoDB, install and configure the popular Database in ubuntu 16.04

Introduction to ArangoDb, open source, NoSQL, multi-model database BigData seems to be getting stronger every day and more and more NoSQL databases are coming out to the market, all trying to position…

How to Choose a Laptop for Web Design and Development

Efficiency is important at work, no matter the type of job you do. The better the tools that you use, the more productive you are. So if you’re a web…

The Best Lightweight Linux Distributions For Older PC's

What do you do with your old computers? The one which once had good hardware configuration but now those are considered outdated. Why not revive your old computer with Linux?…

How to write real client IP address in error Log with Varnish 4 and Apache 2.4 in Ubuntu 16.04

In order to have Varnish 4 pass on the real client IP to your Apache 2.4 error log in Ubuntu 16.04 , you'll need to edit your Varnish configuration (/etc/varnish/default.vcl…

We use our own and third-party cookies to improve our services, compile statistical information and analyze your browsing habits. This allows us to personalize the content we offer and to show you advertisements related to your preferences. By clicking "Accept all" you agree to the storage of cookies on your device to improve website navigation, analyse traffic and assist our marketing activities. You can also select "System Cookies Only" to accept only the cookies required for the website to function, or you can select the cookies you wish to activate by clicking on "settings".

Accept All Only sistem cookies Configuration