|
Have you ever connected a monitor to your laptop and fought to have the image display on the monitor? Or maybe make your desktop wanted to see widespread, but has been a headache, and finally hacks and hacks you've done to the xorg.conf, and has not been well at all. Well I have great news for you. There are already methods to change resolution, extend the desktop horizontally or vertically and all with a few commands. That's why we developed this little PHP script that takes care of everything you need to self-adjust your monitor resolution to put to the right of your laptop and automatically, when connected to extend the desktop.
First things first, the list of requirements: - Linux more or less new, say with Xorg 1.4 or higher
- The xrandr program (apt-get install xrandr in ubuntu or centos yum install xrandr in / fedora)
- PHP CLI or CGI mode installed
- Root privileges on your installation
- A text editor such as joe, nano, pico, kate or similar
Once you turn to the list of requirements we will learn the steps. The first thing to do is detect the resolution of your screen, this is to: xrandr it will look like this: Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 2720 x 1024 VGA-0 connected 1280x1024 +1280 +0 (normal left inverted right x axis and axis) 338mm x 270mm 1280x1024 60.0 * + 75.0 59.9 1152x864 74.8 1024x768 75.1 60.0 800x600 75.0 60.3 640x480 75.0 60.0 720x400 70.1 LVDS connected 1280x800 +0 +0 (normal left inverted right x axis and axis) 0mm x 0mm 1280x800 59.5 * + 60.0 1280x768 60.0 1024x768 60.0 800x600 60.3 640x480 59.9 S-video disconnected (normal left inverted right x axis and axis) As you can realize, in the first line there is a "maximum 2720x1024, this is edited in the file / etc/X11/xorg.conf, find Section" Screen ", and that for the subsection" Display ", a Once I find him, edit or add this line: Virtual 2720 1024 # <--- add this line must The first parameter is the maximum horizontal resolution, say, I have two monitors, my laptop, external of 1280x800 and a 1280x1024 LCD. So 1280 +1280 = 2720 join now vertical, the highest volume since all this going to deploy horizontally. If you were to use the change to vertically, summary of high and would use the largest width to set these parameters. This done, save and restart your graphical environment, you can do with rebooting the machine, or simply stop and restart the service in some distributions when you go to xdm / kdm / gdm (ie where asks login and password) you can press it e or control-alt-e and restarts the graphics. Once you've done this, try again, and check if the maximum is what you wear, it is essential to the second step. Now it's very simple, you just have to tell you which screen is primary and what secondary. I always use the internal laptop as primary, because if the power goes out you lose your primary (if you have no UPS). xrandr - output LVDS - mode 1280x800 This instruction set my primary and LVDS display with a resolution of 1280x800, then goes high school: xrandr - output VGA-0 - right-of LVDS - mode 1280x1024 List! already have manually made the change, and your desktop is extended. But now you must do this automatically. How? because with a script that runs these steps, detect when an external monitor attached, and then detects the highest resolution of the main screen and execute the commands by putting the proper display and proper way. Then, running this script to start your graphical session and keeping it all the time, checking once a minute if there are changes of monitors can be connected or disconnected to automatic resizing. To get the script, I invite you to the download section. Also I invite you to comment on this article in order to improve our quality of content.
|