nixos/xserver: Changed xrandrHeads to support corresponding monitor section configuration in Xorg
This commit is contained in:
parent
75b4bec6fb
commit
bb6a5b079f
@ -17,7 +17,16 @@ has the following highlights: </para>
|
|||||||
A consequence is that UIDs and GIDs are no longer reused.
|
A consequence is that UIDs and GIDs are no longer reused.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Xserver services module now allows one to specify configuration for each monitor.
|
||||||
|
This is done via the xrandrHeads property. It is backwards compatible, so your
|
||||||
|
existing configuration still works. You can replace each monitor designation with
|
||||||
|
an attribute set containing the monitor designation, whether the monitor is the
|
||||||
|
primary monitor, and extra configuration for that specific monitor. Only one
|
||||||
|
monitor can be the primary monitor.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>The following new services were added since the last release:</para>
|
<para>The following new services were added since the last release:</para>
|
||||||
|
@ -33,12 +33,30 @@ let
|
|||||||
|
|
||||||
|
|
||||||
# Just enumerate all heads without discarding XRandR output information.
|
# Just enumerate all heads without discarding XRandR output information.
|
||||||
xrandrHeads = let
|
xrandrHeads = (
|
||||||
mkHead = num: output: {
|
fold
|
||||||
name = "multihead${toString num}";
|
(nextHead: { index, alreadyPrimary, processedHeads }:
|
||||||
inherit output;
|
let
|
||||||
};
|
processedHead = { name = "multihead${toString index}"; } //
|
||||||
in imap mkHead cfg.xrandrHeads;
|
(if isAttrs nextHead then
|
||||||
|
{
|
||||||
|
output = nextHead.output;
|
||||||
|
primary = if alreadyPrimary then false else nextHead.primary || index == 0;
|
||||||
|
monitorConfig = nextHead.monitorConfig;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output = nextHead;
|
||||||
|
primary = if alreadyPrimary then false else index == 0;
|
||||||
|
monitorConfig = "";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
primariness = if alreadyPrimary then true else processedHead.primary;
|
||||||
|
in
|
||||||
|
{ index = index - 1; alreadyPrimary = primariness; processedHeads = ([ processedHead ] ++ processedHeads); })
|
||||||
|
{ index = (length cfg.xrandrHeads) - 1; alreadyPrimary = false; processedHeads = []; }
|
||||||
|
cfg.xrandrHeads
|
||||||
|
).processedHeads;
|
||||||
|
|
||||||
xrandrDeviceSection = let
|
xrandrDeviceSection = let
|
||||||
monitors = flip map xrandrHeads (h: ''
|
monitors = flip map xrandrHeads (h: ''
|
||||||
@ -62,9 +80,13 @@ let
|
|||||||
value = ''
|
value = ''
|
||||||
Section "Monitor"
|
Section "Monitor"
|
||||||
Identifier "${current.name}"
|
Identifier "${current.name}"
|
||||||
|
${optionalString (current.primary) ''
|
||||||
|
Option "Primary" "true"
|
||||||
|
''}
|
||||||
${optionalString (previous != []) ''
|
${optionalString (previous != []) ''
|
||||||
Option "RightOf" "${(head previous).name}"
|
Option "RightOf" "${(head previous).name}"
|
||||||
''}
|
''}
|
||||||
|
${current.monitorConfig}
|
||||||
EndSection
|
EndSection
|
||||||
'';
|
'';
|
||||||
} ++ previous;
|
} ++ previous;
|
||||||
@ -329,12 +351,27 @@ in
|
|||||||
|
|
||||||
xrandrHeads = mkOption {
|
xrandrHeads = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
example = [ "HDMI-0" "DVI-0" ];
|
example = [ "HDMI-0" { output = "DVI-0"; primary = true; monitorConfig = ""; } ];
|
||||||
type = with types; listOf string;
|
type = with types; listOf (either
|
||||||
|
str
|
||||||
|
(submodule {
|
||||||
|
options.output = str;
|
||||||
|
options.primary = bool;
|
||||||
|
options.monitorConfig = lines;
|
||||||
|
})
|
||||||
|
);
|
||||||
description = ''
|
description = ''
|
||||||
Simple multiple monitor configuration, just specify a list of XRandR
|
Simple multiple monitor configuration, just specify a list of XRandR
|
||||||
outputs which will be mapped from left to right in the order of the
|
outputs as the values of the list. The monitors will be mapped from
|
||||||
list.
|
left to right in the order of the list.
|
||||||
|
|
||||||
|
By default, the first monitor will be set as the primary monitor.
|
||||||
|
However instead of a list, you can give an attribute set. That set
|
||||||
|
can contain a primary monitor specification and a custom monitor
|
||||||
|
configuration section.
|
||||||
|
|
||||||
|
Only one monitor is allowed to be primary. If multiple monitors are
|
||||||
|
specified as primary, only the last monitor will be primary.
|
||||||
|
|
||||||
Be careful using this option with multiple graphic adapters or with
|
Be careful using this option with multiple graphic adapters or with
|
||||||
drivers that have poor support for XRandR, unexpected things might
|
drivers that have poor support for XRandR, unexpected things might
|
||||||
|
Loading…
Reference in New Issue
Block a user