@@ -81,13 +81,7 @@ let
8181 monitors = forEach xrandrHeads (h: ''
8282 Option "monitor-${h.config.output}" "${h.name}"
8383 '');
84− # First option is indented through the space in the config but any
85− # subsequent options aren't so we need to apply indentation to
86− # them here
87− monitorsIndented = if length monitors > 1
88− then singleton (head monitors) ++ map (m: " " + m) (tail monitors)
89− else monitors;
90− in concatStrings monitorsIndented;
84+ in concatStrings monitors;
9185
9286 # Here we chain every monitor from the left to right, so we have:
9387 # m4 right of m3 right of m2 right of m1 .----.----.----.----.
@@ -138,10 +132,15 @@ let
138132
139133 echo '${cfg.filesSection}' >> $out
140134 echo 'EndSection' >> $out
135+ echo >> $out
141136
142137 echo "$config" >> $out
143138 ''; # */
144139
140+ prefixStringLines = prefix: str:
141+ concatMapStringsSep "\n" (line: prefix + line) (splitString "\n" str);
142+
143+ indent = prefixStringLines " ";
145144in
146145
147146{
@@ -736,29 +735,29 @@ in
736735 Section "ServerFlags"
737736 Option "AllowMouseOpenFail" "on"
738737 Option "DontZap" "${if cfg.enableCtrlAltBackspace then "off" else "on"}"
739− ${cfg.serverFlagsSection}
738+ ${indent cfg.serverFlagsSection}
740739 EndSection
741740
742741 Section "Module"
743− ${cfg.moduleSection}
742+ ${indent cfg.moduleSection}
744743 EndSection
745744
746745 Section "Monitor"
747746 Identifier "Monitor[0]"
748− ${cfg.monitorSection}
747+ ${indent cfg.monitorSection}
749748 EndSection
750749
751750 # Additional "InputClass" sections
752− ${flip concatMapStrings cfg.inputClassSections (inputClassSection: ''
753− Section "InputClass"
754− ${inputClassSection}
755− EndSection
751+ ${flip (concatMapStringsSep "\n") cfg.inputClassSections (inputClassSection: ''
752+ Section "InputClass"
753+ ${indent inputClassSection}
754+ EndSection
756755 '')}
757756
758757
759758 Section "ServerLayout"
760759 Identifier "Layout[all]"
761− ${cfg.serverLayoutSection}
760+ ${indent cfg.serverLayoutSection}
762761 # Reference the Screen sections for each driver. This will
763762 # cause the X server to try each in turn.
764763 ${flip concatMapStrings (filter (d: d.display) cfg.drivers) (d: ''
@@ -781,9 +780,9 @@ in
781780 Identifier "Device-${driver.name}[0]"
782781 Driver "${driver.driverName or driver.name}"
783782 ${if cfg.useGlamor then ''Option "AccelMethod" "glamor"'' else ""}
784− ${cfg.deviceSection}
785− ${driver.deviceSection or ""}
786− ${xrandrDeviceSection}
783+ ${indent cfg.deviceSection}
784+ ${indent (driver.deviceSection or "")}
785+ ${indent xrandrDeviceSection}
787786 EndSection
788787 ${optionalString driver.display ''
789788
@@ -794,18 +793,22 @@ in
794793 Monitor "Monitor[0]"
795794 ''}
796795
797− ${cfg.screenSection}
798− ${driver.screenSection or ""}
796+ ${indent cfg.screenSection}
797+ ${indent (driver.screenSection or "")}
799798
800799 ${optionalString (cfg.defaultDepth != 0) ''
801800 DefaultDepth ${toString cfg.defaultDepth}
802801 ''}
803802
804803 ${optionalString
805− (driver.name != "virtualbox" &&
804+ (
805+ driver.name != "virtualbox"
806+ &&
806807 (cfg.resolutions != [] ||
807808 cfg.extraDisplaySettings != "" ||
808− cfg.virtualScreen != null))
809+ cfg.virtualScreen != null
810+ )
811+ )
809812 (let
810813 f = depth:
811814 ''
@@ -813,7 +816,7 @@ in
813816 Depth ${toString depth}
814817 ${optionalString (cfg.resolutions != [])
815818 "Modes ${concatMapStrings (res: ''"${toString res.x}x${toString res.y}"'') cfg.resolutions}"}
816− ${cfg.extraDisplaySettings}
819+ ${indent cfg.extraDisplaySettings}
817820 ${optionalString (cfg.virtualScreen != null)
818821 "Virtual ${toString cfg.virtualScreen.x} ${toString cfg.virtualScreen.y}"}
819822 EndSubSection