yavdr-ansible/roles/yavdr-xorg/templates/20-intel.conf.j2
Alexander Grothe 76ace23b5e Improve Compatibility with Python3
replace .iteritems() with .items | list in jinja2 Templates
2019-02-24 18:42:46 +01:00

102 lines
2.8 KiB
Django/Jinja

{{ ansible_managed | comment }}
{% set primary_output = xorg.primary.connector|replace("-", "") %}
{% if xorg.secondary is defined %}
{% set secondary_output = xorg.secondary.connector|replace("-", "") %}
{% endif %}
Section "Device"
Identifier "Device0"
Driver "intel"
Option "TearFree" "true"
{% if xorg.secondary is defined %}
Option "ZaphodHeads" "{{ primary_output }}"
Screen 0
{% endif %}
EndSection
{% if xorg.secondary is defined %}
Section "Device"
Identifier "Device1"
Driver "intel"
Option "TearFree" "true"
Option "ZaphodHeads" "{{ secondary_output }}"
Screen 1
EndSection
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
EndSection
{% endif %}
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "{{ primary_output }}"
DefaultDepth 24
SubSection "Display"
Depth 24
{% if xorg.primary.mode %}
Modes "{{ xorg.primary.mode }}"
{% else %}
Modes "1920x1080_50" "1920x1080_60" "1920x1080_24"
{% endif %}
EndSubSection
EndSection
{% if xorg.secondary is defined %}
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "{{ secondary_output }}"
DefaultDepth 24
SubSection "Display"
Depth 24
{% if xorg.secondary.mode %}
Modes "{{ xorg.secondary.mode }}"
{% else %}
Modes "1920x1080_50" "1920x1080_60" "1920x1080_24"
{% endif %}
EndSubSection
EndSection
{% endif %}
Section "Monitor"
Identifier "{{ primary_output }}"
{% if xorg.primary.modelines %}
{% for modeline in xorg.primary.modelines %}
{{ modeline }}
{% endfor %}
{% else %}
Modeline "1920x1080_24" 74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_50" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_60" 148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
{% endif %}
EndSection
{% if xorg.secondary is defined %}
Section "Monitor"
Identifier "{{ secondary_output }}"
{% if xorg.secondary.modelines %}
{% for modeline in xorg.secondary.modelines %}
{{ modeline }}
{% endfor %}
{% else %}
Modeline "1920x1080_24" 74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_50" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_60" 148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
{% endif %}
EndSection
{% endif %}
{% for connector, data in xrandr["Screen 0:"].items() | list %}
{% if not data.is_connected or connector != xorg.primary.connector or (xorg.secondary is defined and connector != xorg.secondary.connector) %}
Section "Monitor"
Identifier "{{ connector|replace("-","") }}"
Option "Ignore" "true"
EndSection
{% endif %}
{% endfor %}