Разрешение экрана в Linux
С развитием технологий экраны для компьютеров смогли значительно увеличить разрешение. Если старые экраны показывали 640х800 пикселей, то более новые отображают уже 1920х1080. У последних моделей разрешение ещё выше.
В операционной системе Linux существует несколько способов настройки разрешения экрана. В обычных системах, как правило, это не нужно. Но если вы хотите использовать несколько мониторов или решили запустить Linux на виртуальной машине, то разрешение может определиться неправильно и тогда придётся его настроить. В этой статье мы рассмотрим, как изменить разрешение экрана в Linux через графический интерфейс и терминал.
Настройка разрешения экрана в GUI
Разберём настройку разрешения на примере дистрибутива Ubuntu и окружения рабочего стола Gnome. Откройте утилиту Настройки из главного меню:
Перейдите на вкладку Устройства, а затем выберите пункт Настройка экранов:
Если к компьютеру подключено два монитора Linux или больше, то у вас будет три варианта работы экранов:
- Объединение — все экраны объединяются в одно рабочее пространство;
- Зеркальное отображение — одинаковая картинка на всех экранах;
- Один экран — картинка только на одном экране, другие отключены.
Независимо от того, какой режим вы выбираете, будут доступны настройки Разрешение и Частота обновления, где вы сможете настроить нужные вам параметры:
Так выполняется настройка монитора Linux через графический интерфейс. Если вы хотите объединить экраны, то можно указать разрешение мониторов Linux для каждого из них отдельно:
Но здесь есть один недостаток, вы можете выбрать только то разрешение экрана, которое предлагает система. Если вы захотите установить разрешение выше или ниже тех, что есть, то у вас ничего не выйдет. Для этого надо воспользоваться терминалом.
Как изменить разрешение экрана через терминал
Для управления настройками экрана из терминала можно использовать утилиту xrandr. Синтаксис утилиты очень прост:
xrandr опции параметры
Разберём основные опции утилиты, которые будем использовать:
- —verbose — включить более подробный вывод;
- —version — версия программы;
- —query — когда установлена эта опция или не указанно никаких опций, выводится текущая конфигурация;
- -d, —display — позволяет указать какой X экран использовать по имени;
- -s, —screen — устанавливает дисплей для настройки по ID;
- —output — устанавливает дисплей для настройки по имени или ID;
- —primary — выбрать основной экран;
- —size — позволяет указать размер экрана;
- —rate — устанавливает частоту обновления;
- —dpi — устанавливает DPI, количество точек на дюйм, которое позволяет вычислить правильный размер для окон;
- —newmode — создаёт новый режим отображения по размеру и частоте;
- —rmmode — удаляет режим отображения;
- —addmode — добавляет созданный режим к списку доступных для использования;
- —delmode — удалить режим из списка доступных;
- —mode — активирует указанный режим;
- —off — отключает экран;
- —gamma — позволяет установить коррекцию гаммы, в формате красный:зеленый:синий;
Чтобы посмотреть текущие параметры системы, запустите утилиту без параметров:
Как видите, к моей системе подключено два экрана:
- LVDS-1 — встроенный экран ноутбука;
- HDMI-1 — внешний экран;
Для каждого экрана доступно несколько разрешений, текущее разрешение отмечено звёздочкой. Чтобы изменить разрешение экрана Linux на одно из доступных, используйте опцию —mode вместе с —output:
xrandr —output HDMI-1 —mode 1680×1050
Теперь звёздочка выводится около разрешения 1680х1050.
Хорошо, мы разобрались с тем, как добавить одно из существующих разрешений. По сути, то же самое, что и в графическом интерфейсе. Но если нужного разрешения в списке нет, то его можно добавить. Для этого сначала нужно конвертировать обычную запись в формат VESA. Для этого используйте утилиту cvt. Например, создадим режим с разрешением 2000х1100 и частотой обновления 60:
cvt 2000 1100 60
Дальше надо скопировать из вывода утилиты всё, что написано после «Modeline». Осталось использовать скопированный текст в xrandr:
xrandr —newmode «2000x1100_60.00» 183.75 2000 2136 2344 2688 1100 1103 1113 1141 -hsync +vsync
Добавляем только что созданное разрешение к списку доступных для нужного нам экрана:
xrandr —addmode HDMI-1 2000x1100_60.00
А затем активируем, как описывалось выше:
xrandr —output HDMI-1 —mode 2000x1100_60.00
Но будьте аккуратны с новыми разрешениями. Если вы устанавливаете разрешение выше, чем поддерживает ваш монитор, то он просто не будет показывать. Но такая штука может быть полезна с VirtualBox, или если компьютер не определяет, что ваш монитор поддерживает более высокое разрешение.
Чтобы сохранить настройки после перезагрузки, добавьте команду активации разрешения в конфигурационный файл
Синтаксис файла очень похож на
/.xinitrc. Все команды из него автоматически выполняются при старте сессии. Или же вы можете использовать любой другой метод автозагрузки, который работает после запуска X.
Выводы
В этой статье мы рассмотрели несколько способов настроить разрешение экрана Linux с помощью графического интерфейса или через терминал. Как видите, это не так сложно, как может показаться на первый взгляд.
Источник
Change screen resolution on Linux Mint
I have just installed Linux Mint 14 and I cannot change the screen resolution. The appropriate resolution 1920 x 1200, just isn’t among the options.
I have tried this solution but it reports:
I have also tried this, but it reports:
Edit1
My graphics card information:
Running sudo lshw -class outputs:
Edit2
Running xrandr command in terminal outputs:
This is without nvidia driver installed.
Edit3
After executing command xrandr —newmode «1920x1200_60.00» 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync it reports:
Edit4
When I try solution from here running sudo Xorg -configure , I get:
5 Answers 5
Based on your xrandr output above there are two problems; firstly the output name is VGA-2 (not VGA0) and secondly it seems that you don’t have a mode available for 1920×1200.
First just try setting the resolution:
If that doesn’t work (which I think it won’t as 1920×1200 isn’t a mode) then do the following:
Copy and paste the full modeline information e.g. for me I get:
What we want to copy is what is after Modeline e.g. «1920x1200_60.00» 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
Now do the following:
e.g. in the second command after the VGA-2 we put the bit in quotes from modeline
The same descriptor for the mode.
This should create a new mode of 1920×1200, assign that mode for VGA-2 and then set VGA-2 to use that mode.
Try to stop your XServer before dongin Xorg -configure.
- Log-out of all accounts.
- Press Ctrl+Alt+F1
- Log-in with your regular account (take care if yo use number with num lock — try with your login to see)
- Run sudo service mdm stop
- Run nvidia-settings if you have this one or Xorg -configure
- Run sudo service mdm start
- If you’re still on terminal, press Ctrl+Alt+F7 and log-in
You want to use nvidia-settings if it isn’t installed yet install it. It will access the proprietary nvidia drivers directly and you should be able to configure them. If that doesn’t work try the answer here: http://community.linuxmint.com/tutorial/view/176
Sorry if you wanted a terminal-based answer; I’m not that hard-core.
What worked for me was a similar approach to Dave C’s. My monitor wasn’t being identified so the driver would only give me the standard resolutions.
Источник
Change resolution linux mint
Linux does not have as much options for display resolutions as in windows. A 22″ Monitor in linux will have 1920×1080, 1440×900, 1280×960, 1024×768 resolutions. Some users may need resolution like 1600×900, 1366×768 for some purposes. These resolutions can be added manually in Linux. Basic steps for adding 1600×900 resolution are explained as under which can be modified for any other screen resolution by changing values 1600×900 with your required one.
1. First step is to create modeline. This is done to get appropriate values of hsync, vsync and other parameters which are required to display a resolution properly in the backend. To add resolution of 1600×900, open terminal and type:
This will create modeline for resolution of 1600×900 which will look something like this:
1600×900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
Modeline «1600x900_60.00» 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
These numbers may vary according to your monitor.
2. To add this resolution to monitor settings, type the following highlighted commands one by one:
xrandr —newmode «1600x900_60.00» 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
(values after xrandr —newmode to be pasted from second line of generated values with cvt command from your own computer, don’t copy from here. In other words, after writing xrandr —newmode in terminal, copy the output of cvt command from its second line excluding word Modeline upto its end and paste it after xrandr —addmode. )
xrandr —addmode VGA1 «1600x900_60.00»
After these steps, resolution of 1600×900 will appear under the list of various resolutions available in display settings. This will remain listed for one session only. When computer is restarted, this will disappear. To make it appear permanently, we need to configure xorg.conf file and make this entry manually.
3. In Mint, xorg.conf is not present by default and has to be created. This can be created only when x server is not working ie. in console mode otherwise system will give error. Type these highlighted commands one by one in console mode:
Alt+Ctrl+F1 (switch to console mode)
Login by typing user name and password
sudo service lightdm stop (For Mint 12 Lisa users) or sudo service mdm stop (For Mint 13 Maya users)
sudo X -configure (generates new xorg.conf file )
File with name xorg.conf.new will be created in Home folder. Although some error message will appear but file will be created. Just ignore that message.
Note: 1.Use only one of the commands (from sudo service lightdm stop or sudo service mdm stop) according to your distro edition. These are used to kill x server.
2. In Mint 13 maya, after sudo service mdm stop, Alt + Ctrl + F1 has to be pressed again.
4. To switch back to graphical mode, type:
sudo start lightdm (Mint 12 Lisa users)
sudo service mdm start (Mint 13 Maya users)
If above commands fail to bring back graphical mode, just restart your computer.
5. Open Home folder. Rename this file from xorg.conf.new to xorg.conf Open xorg.conf with text editor and make the following changes. Underline shows newly added lines
- Add Modeline in Monitor Section under each Identifier option. Example:
Section «Monitor»
Identifier «Monitor0»
Modeline «1600x900_60.00» 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
VendorName «Monitor Vendor»
ModelName «Monitor Model»
EndSection
Section «Monitor»
Identifier «Monitor1»
Modeline «1600x900_60.00» 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
VendorName «Monitor Vendor»
ModelName «Monitor Model»
EndSection
- Add modes in screen section in similar way as described above in each subsection (screen1, screen2) under the element Depth (Also for each depth). Example :
Section «Screen»
Identifier «Screen0»
Device «Card0»
Monitor «Monitor0»
SubSection «Display»
Viewport 0 0
Depth 1
Modes «1600×900»
EndSubSection
SubSection «Display»
Viewport 0 0
Depth 4
Modes «1600×900»
EndSubSection
SubSection «Display»
Viewport 0 0
Depth 8
Modes «1600×900»
EndSubSection
Identifier «Screen1»
Device «Card1»
Monitor «Monitor1»
SubSection «Display»
Viewport 0 0
Depth 1
Modes «1600×900»
EndSubSection
SubSection «Display»
Viewport 0 0
Depth 4
Modes «1600×900»
EndSubSection
SubSection «Display»
Viewport 0 0
Depth 8
Modes «1600×900»
EndSubSection
6. Save this file and copy this file to /etc/X11/ by typing following command:
sudo cp xorg.conf /etc/X11
(assuming that xorg.conf is located at Home folder) or do it by graphically if you know.
Note: New resolution must be less than Maximum resolution that monitor can support. And care fully add those lines to each subsection Monitor0, Monitor1, Monitor2, Monitor3, Screen1, Screen2, Screen3, Screen4. For Screen section, add entries for every Depth from 1, 2, 4, 8, 16, 24.
Источник