Linux

xrandr – Configure and Manage Your Linux Screens

When using Linux, it’s common to run into problems related to display devices. For instance, changing your display monitor may sometimes result into undetected native resolution or misconfigured resolution for your display monitor. If you are trying to add extra display monitor to your system and create multi-monitor setup, that might also sometimes create situation where your second monitor remain undetected. There might be many reasons why your display monitor is not being recognized by kernel drivers automatically. Today we are going to use xrandr, a command line utility which can be used to set the size, orientation or reflection of the outputs for a screen in Linux system.

Also See: How to Limit CPU Usage

xrandr – Set custom resolution

To push the resolution to display monitor, first we are need to list all the displays moniter attached to our system just by simply issuing a xrandr command with following arguments on terminal.

#xrandr --listactivemonitors

Here you can see the name of our display monitors is eDP1, as shown in the picture below.

List Monitor
List Monitor

To list all the outputs on your system along with their resolution mode and refresh rate you simply issue xrandr command with no arguments.

#xrandr

Simple xrandr command lists all the resolution mode and refresh rate, as shown below.

Now in order to set custom resolution, we first need to output some required parameters using cvt command. You just type in the cvt on your terminal along with your desired resolution.

#cvt 1300 800

The particular parameters that are needed by xrandr to know in order to readjust the screen resolution is highlighted in red as shown in the picture below.

Next we need to create new resolution mode. Copy the required parameters and paste it with xrandr command on terminal as shown below.

#xrandr --newmode "1304x800_60.00" 84.75 1304 1376 1504 1704 800 803 813 831 -hsync +vsync

Here, in previous command name of your mode comes under double quotation which is “1304x800_60.00”. In next step we need to add this newly created mode to our display monitor by issuing command shown below.

#xrandr --addmode eDP1 1304x800_60.00

Finally, we will push this resolution mode to display monitor.

#xrandr --output eDP1 --mode 1304x800_60.00

Now we have changed our screen resolution by using simple xrandr command and tweaking few variables. xrandr comes handy when resolution of your display monitor is not detected automatically by your system.

As soon as you restart your system, you will lose all the changes. But there’s a way around this, which you can use to permanently add undetected resolution to your system.

Once a suitable resolution is configured using xrandr, then that mode can be permanently added to to system by creating an entry in /etc/X11/xorg.conf.d/ directry.

#vi /etc/X11/xorg.conf.d/10-monitor.conf

Now copy and paste the directives given below to the file mentioned above.

Section "Monitor"
    Identifier "eDP1"
    Modeline "1304x800_60.00" 84.75 1304 1376 1504 1704 800 803 813 831 -hsync +vsync
    Option "PreferredMode" "1304x800_60.00"
EndSection

Here you can save as many mode as you want for all the other display monitors as well.

 

About the author

Ajay Verma

A Computer Science Graduate, who works extensively on open source projects. His Areas Of interest are: Network Security, Linux Administration, FOSS, Python, and C programming.

Add Comment

Click here to post a comment