lunedì 23 marzo 2015

XrandR - dualmonitor - screen resolution

XRandR

First I will show you a few examples of using xrandr for dynamic and on-the-fly setup and (re)configuration.
With the first command we will query our hardware:
   $ xrandr -q
After checking the output, let's suppose that you have a laptop which panel is eDP1 and an external VGA port which we will regard as DP1, we execute:
   $ xrandr --output DP1 --mode 1280x1024 --right-of eDP1
The above command is straightforward, your DP1 monitor is initialised using 1280x1024 resolution and it's placement is Right Of your DP1 screen (let's say that DP1 is 1280x800). The important thing to remember is that you will then have one big screen whose size will then be 2560x1024. If the above command failed then you probably didn't take this into account when setting up yourxorg.conf (you need to configure your Virtual size), more about this a few lines below.
It happens quite frequently that xrandr can not find the 'best' resolution for your external monitor. Let alone the correct refresh rate. When this happens, you need to create a modeline (gtf), then add it to the appropriate output. Here are a couple simple commands that would create a new 1280x1024 at 60Hz refresh and attach it to the DP1 output:
   $ xrandr --newmode $(gtf 1280 1024 60 | grep Modeline | sed s/Modeline\ // | tr -d '"')
   $ xrandr --addmode DP1 1280x1024_60.00
For other uses of xrandr read the manual page. I will show just one other example, disabling your external display:
   $ xrandr --output DP1 --off
Here is a simple script that somewhat simplifies the task of picking the correct refresh rate and then setting up your screens stupid.sh

fonte: awesome.naquadah.org (adapted to work with kubuntu on a dell latitude E5540 machine)