Schermresolutie aanpassen (Linux)
Ik werk meestal met een dual-monitor-configuratie. Meestal gaat dat goed, maar eens in de zoveel tijd herkent het OS m'n tweede scherm niet meer. Vervolgens ben ik beperkt tot een resolutie van 1024 x 768 ipv. 1280 x 1024 of whatever. Via het gebruikelijke configuratiescherm krijg ik dat niet verbeterd.
arandr
arandr is een grafische tool om X te configureren. Installatie werkt via apt-get, maar bespaar je de moeite: Je kunt geen resoluties toevoegen.
lxrandr
lxrandr is een broertje van arandr. Iets mooier, maar even beperkt.
Casus: 23 juli 2014
Dit was een xrandr-onderonsje:
cvt 1280 1024
De output van dit commando is ingevoegd in het volgende commando:
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
En de identifier 1280x1024_60.00 is vervolgens hergebruikt in commando:
xrandr --addmode VGA1 1280x1024_60.00
Aansluitend kon ik via het icoontje in het systeemvak de resolutie aanpassen. Ik had ergens begrepen dat deze instellingen niet worden onthouden voor de volgende inlog-gebeurtenis, en dat klopte: Na uitloggen en opnieuw inloggen, kreeg ik een foutmelding van X, en alle beeldscherminstellingen waren foetsie. Cinnamon leek die gebeurtenis ook niet zonder kleerscheuren te doorstaan. Nadat ik opnieuw bovenstaande commando's gaf, had ik weer de juiste instellingen. Maar hoe dit permanent te maken? Ik gebruik Linux Mint 13 Maya. Ik betwijfel of-ie GDM gebruikt.
Aan de hand van deze tutorial heb ik xorg.conf aangemaakt. Uitgelogd en weer ingelogd: Helaas. Alles werkt, behalve de hoge resolutie. Ik had de indruk dat ik bij het uitloggen een terminal-scherm voorbij zag flitsen met de inhoud van het betreffende xorg.conf-bestand. Een teken dat dit bestand een fout veroorzaakt?
Casus: 25 juli 2014
Ok. Blijkbaar is het onvermijdelijk dat ik me in randr ga verdiepen. Komt-ie, te beginnen met een paar definities:
- Een monitor is een fysiek apparaat
- Een screen is een X-Windows-scherm. Een screen wordt afgebeeld op een monitor
- Een display is de verzameling van screens. Bij een multi-monitor-setup heb je bv. een display die uit twee screens bevat. Als alles goed gaat, wordt elk screen op de bijbehorende monitor weergegeven.
En nu een stukje geschiedenis: X Windows stamt uit 1984, in de tijd van de time-sharing systemen, waarbij mensen via eenvoudige terminals op een centrale computer werkten. De X-server en de X-clients waren zodoende gescheiden van elkaar. Die tijd is voorbij, en tegenwoordig bevinden X-server en -client zich doorgaans op dezelfde computer. Het is zelfs vrij complex om deze daadwerkelijk te scheiden. Ondertussen is X een nogal uit de kluiten gewassen systeem geworden. Er zit zelfs nog code in om polygonen te tekenen. Het soort van dingen die ik de jaren 80 deed, en die nog steeds kunnen met X. Er zijn verschillende manieren voorbijgekomen om met multi-display-configuraties om te gaan:
- DISPLAY-variabele: Aparte screens middels de DISPLAY-variabele. Dit werkt alleen met specifieke programma's, waaronder Gimp en Emacs
- Zaphod display: Een zelden toegepaste time-sharing-achtige oplossing
- Twin-View: Iets onzaligs van nVidia
- 'Xinerama: Iets spannends dat tegenwoordig niet meer meedoet. Hier kunnen ze je daar alles over vertellen
- randr, wat staat voor Rotate and Resize. Ik geloof dat dit tegenwoordig de enige relevante extensie is voor het configureren van multi-monitor-systemen binnen X. Het kan benaderd worden via de xrandr tool of geconfigureerd worden via een xorg.conf-bestand.
Persistentie
Uiteraard moet eerst de betreffende resolutie beschikbaar worden gemaakt, en vervolgens worden toegepast. Om deze configuratie te behouden, is lastiger. Er zijn verschillende mogelijkheden:
- xorg.conf: Genereer een xorf.conf-bestand inclusief de nieuwe resolutie. Nadeel: Statisch. Ik vraag me af wat er gebeurd als ik met m'n laptop wissel van externe monitor. In het bijzonder, als ik wissel van een grote naar een kleine monitor
- Autostarting xrandr: Start xrandr elke keer als X start. Dan moet je wel zo'n script hebben, en deze start na de display manager (inlogscherm)
- Scripts: Op het moment dat bv. een scherm wordt aangesloten, een script starten om dit te regelen.
Er lijkt nog een complicatie te zijn: Als ik een scherm correct configureer en deze instellingen niet opsla, geeft X foutmeldingen als ik opnieuw inlog, en de window manager doet het vervolgens niet goed.
Ik kies de eerste optie, want het meest gebruikelijke.
Bron: https://wiki.archlinux.org/index.php/Xrandr#Configuration
Modeline achterhalen
Gebruik cvt om de VESA Coordinated Video Timing mode te achterhalen, of gtf om de VESA Generalized Timing Formula mode te achterhalen. Ik gebruik deze eerste:
cvt 1280 1024 # 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
Deze modeline heeft als naam:
"1280x1024_60.00"
Nieuwe xrandr modus toevoegen
Gebruik de output van cvt (zonder het woord modeline) als input om in xrandr een nieuwe modus toe te voegen:
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
Welk apparaat?
We moeten de modus toevoegen aan een apparaat. Maar welk apparaat? Daar weet xrandr antwoord op:
xrandr Screen 0: minimum 320 x 200, current 2390 x 777, maximum 8192 x 8192 LVDS1 connected 1366x768+1024+9 (normal left inverted right x axis y axis) 344mm x 194mm 1366x768 60.0*+ 1360x768 59.8 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 1024x768 60.0* 800x600 60.3 56.2 848x480 60.0 640x480 59.9 HDMI1 disconnected (normal left inverted right x axis y axis) DP1 disconnected (normal left inverted right x axis y axis) 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) 1280x1024_60.00 (0xcc) 109.0MHz h: width 1280 start 1368 end 1496 total 1712 skew 0 clock 63.7KHz v: height 1024 start 1027 end 1034 total 1063 clock 59.9Hz
Merk op dat de nieuwe modus onderaan is toegevoegd. Misschien geeft dit aan dat xrandr de modus kent, maar dat-ie nog nergens aan is toegekend.
Modus toekennen aan een monitor
xrandr --addmode VGA1 1280x1024_60.00
Toepassen
Op de gebruikelijke manier kan deze nieuwe resolutie nu toepassen. Nu nog persistent maken door een xorg.conf-bestand aan te maken.
Standaard xorg.conf-bestand aanmaken
Een xorg.conf-bestand kan alleen aangemaakt worden op het moment dat X niet actief is. X om zeep helpen gaat als volgt:
- Start een console middels Alt-Ctrl-F1
- Stop de display manager:
sudo service mdm stop
Ik kwam twee manieren tegen om een basis-xorg.conf-bestand te generen:
sudo X -configure
en
sudo Xorg :0 -configure
Het leverde twee identieke bestanden op. Da's goed: Ik houd van consistentie!
Nu weer terug naar X:
sudo service mdm start
Het betreffende bestand:
Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen0" 0 0 Screen 1 "Screen1" RightOf "Screen0" Screen 2 "Screen2" RightOf "Screen1" InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" EndSection Section "Files" ModulePath "/usr/lib/xorg/modules" FontPath "/usr/share/fonts/X11/misc" FontPath "/usr/share/fonts/X11/cyrillic" FontPath "/usr/share/fonts/X11/100dpi/:unscaled" FontPath "/usr/share/fonts/X11/75dpi/:unscaled" FontPath "/usr/share/fonts/X11/Type1" FontPath "/usr/share/fonts/X11/100dpi" FontPath "/usr/share/fonts/X11/75dpi" FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" FontPath "built-ins" EndSection Section "Module" Load "dri" Load "record" Load "dri2" Load "extmod" Load "glx" Load "dbe" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/input/mice" Option "ZAxisMapping" "4 5 6 7" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Monitor Vendor" ModelName "Monitor Model" EndSection Section "Monitor" Identifier "Monitor1" VendorName "Monitor Vendor" ModelName "Monitor Model" EndSection Section "Monitor" Identifier "Monitor2" VendorName "Monitor Vendor" ModelName "Monitor Model" EndSection Section "Device" ### Available Driver options are:- ### Values: <i>: integer, <f>: float, <bool>: "True"/"False", ### <string>: "String", <freq>: "<f> Hz/kHz/MHz", ### <percent>: "<f>%" ### [arg]: arg optional #Option "DRI" # [<bool>] #Option "ColorKey" # <i> #Option "VideoKey" # <i> #Option "FallbackDebug" # [<bool>] #Option "Tiling" # [<bool>] #Option "LinearFramebuffer" # [<bool>] #Option "Shadow" # [<bool>] #Option "SwapbuffersWait" # [<bool>] #Option "TripleBuffer" # [<bool>] #Option "XvMC" # [<bool>] #Option "XvPreferOverlay" # [<bool>] #Option "DebugFlushBatches" # [<bool>] #Option "DebugFlushCaches" # [<bool>] #Option "DebugWait" # [<bool>] #Option "HotPlug" # [<bool>] #Option "RelaxedFencing" # [<bool>] Identifier "Card0" Driver "intel" BusID "PCI:0:2:0" EndSection Section "Device" ### Available Driver options are:- ### Values: <i>: integer, <f>: float, <bool>: "True"/"False", ### <string>: "String", <freq>: "<f> Hz/kHz/MHz", ### <percent>: "<f>%" ### [arg]: arg optional #Option "ShadowFB" # [<bool>] #Option "Rotate" # <str> #Option "fbdev" # <str> #Option "debug" # [<bool>] Identifier "Card1" Driver "fbdev" BusID "PCI:0:2:0" EndSection Section "Device" ### Available Driver options are:- ### Values: <i>: integer, <f>: float, <bool>: "True"/"False", ### <string>: "String", <freq>: "<f> Hz/kHz/MHz", ### <percent>: "<f>%" ### [arg]: arg optional #Option "ShadowFB" # [<bool>] #Option "DefaultRefresh" # [<bool>] #Option "ModeSetClearScreen" # [<bool>] Identifier "Card2" Driver "vesa" BusID "PCI:0:2:0" EndSection Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" SubSection "Display" Viewport 0 0 Depth 1 EndSubSection SubSection "Display" Viewport 0 0 Depth 4 EndSubSection SubSection "Display" Viewport 0 0 Depth 8 EndSubSection SubSection "Display" Viewport 0 0 Depth 15 EndSubSection SubSection "Display" Viewport 0 0 Depth 16 EndSubSection SubSection "Display" Viewport 0 0 Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen1" Device "Card1" Monitor "Monitor1" SubSection "Display" Viewport 0 0 Depth 1 EndSubSection SubSection "Display" Viewport 0 0 Depth 4 EndSubSection SubSection "Display" Viewport 0 0 Depth 8 EndSubSection SubSection "Display" Viewport 0 0 Depth 15 EndSubSection SubSection "Display" Viewport 0 0 Depth 16 EndSubSection SubSection "Display" Viewport 0 0 Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen2" Device "Card2" Monitor "Monitor2" SubSection "Display" Viewport 0 0 Depth 1 EndSubSection SubSection "Display" Viewport 0 0 Depth 4 EndSubSection SubSection "Display" Viewport 0 0 Depth 8 EndSubSection SubSection "Display" Viewport 0 0 Depth 15 EndSubSection SubSection "Display" Viewport 0 0 Depth 16 EndSubSection SubSection "Display" Viewport 0 0 Depth 24 EndSubSection EndSection
Kan ik dit xorg.conf-bestand gelijk toepassen?
Om dit bestand te gebruiken:
- Alt-F2 gevolgd door
gksu nautilus
- Kopiëer bestand xorg.conf.new naar /etc/X11/xorg.conf.
Daarna uitgelogd en weer ingelogd: Niets te merken. Daarna de computer herstart, en weer niets te merken. Ik ga er maar van uit dat bestand 'dus' gewoon werkt ;)
Casus: Linux Mint 18 - Laptop Dell2017
Menu » Administration » NVIDIA X Server Settings » X Server Display Configuration » Resolution
Bronnen
- https://wiki.archlinux.org/index.php/xrandr
- https://wiki.archlinux.org/index.php/Multihead
- https://wiki.archlinux.org/index.php/Xrandr#Adding_undetected_resolutions
- http://community.linuxmint.com/tutorial/view/877
- http://forums.linuxmint.com/viewtopic.php?f=206&t=134428 - How to change Screen Resolution in Mint 14
- http://forums.linuxmint.com/viewtopic.php?f=49&t=118472 - Fixed screen display resolution default setting 1024x800
- http://www.ubuntugeek.com/how-change-display-resolution-settings-using-xrandr.html - How change display resolution settings using xrandr
- http://forums.linuxmint.com/viewtopic.php?f=42&t=100537 - Hoe je de instellingen permanent maakt (Mint 12)
- http://community.linuxmint.com/tutorial/view/877 - Add new screen resolution in Linux Mint - Heel aardig.