mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
vanadium: minor refactor display config
This commit is contained in:
parent
a6be9276c0
commit
e3c26ec831
1 changed files with 10 additions and 19 deletions
|
|
@ -41,13 +41,11 @@
|
||||||
|
|
||||||
allDevices = ["eDP-1"] ++ allExternDevices;
|
allDevices = ["eDP-1"] ++ allExternDevices;
|
||||||
|
|
||||||
/**
|
# TODO: merge when upstream is merged
|
||||||
TODO: merge when upstream is merged
|
# https://github.com/NixOS/nixpkgs/pull/436434
|
||||||
https://github.com/NixOS/nixpkgs/pull/436434
|
#
|
||||||
|
# Generate an attribute set by mapping a function over a list of attribute names.
|
||||||
Generate an attribute set by mapping a function over a list of attribute names.
|
# It allows setting the name of the attribute.
|
||||||
It allows setting the name of the attribute.
|
|
||||||
*/
|
|
||||||
genAttrs' = xs: func: builtins.listToAttrs (map func xs);
|
genAttrs' = xs: func: builtins.listToAttrs (map func xs);
|
||||||
|
|
||||||
mkDpiSwitch = {dpi}: {
|
mkDpiSwitch = {dpi}: {
|
||||||
|
|
@ -57,6 +55,7 @@
|
||||||
''}";
|
''}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Is scoped to an output device, no need to be called on built-in display
|
||||||
mkBrightnessSwitch = {
|
mkBrightnessSwitch = {
|
||||||
device,
|
device,
|
||||||
brightness,
|
brightness,
|
||||||
|
|
@ -69,10 +68,7 @@
|
||||||
# Note: the "position" field corresponds to the "pos" field outputted by autorandr
|
# Note: the "position" field corresponds to the "pos" field outputted by autorandr
|
||||||
# To get the current config, run `xrandr --auto` and then `autorandr --config`
|
# To get the current config, run `xrandr --auto` and then `autorandr --config`
|
||||||
configs = {
|
configs = {
|
||||||
allOff = genAttrs' allDevices (name: {
|
allOff = lib.genAttrs allDevices (_: {enable = false;});
|
||||||
inherit name;
|
|
||||||
value = {enable = false;};
|
|
||||||
});
|
|
||||||
enableBuiltin = {
|
enableBuiltin = {
|
||||||
eDP-1 = {
|
eDP-1 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -96,8 +92,7 @@
|
||||||
|
|
||||||
frameworkBuiltin = {
|
frameworkBuiltin = {
|
||||||
fingerprint.eDP-1 = built-in;
|
fingerprint.eDP-1 = built-in;
|
||||||
config = with configs;
|
config = with configs; allOff // enableBuiltin;
|
||||||
allOff // enableBuiltin;
|
|
||||||
hooks.postswitch = mkDpiSwitch {dpi = 150;};
|
hooks.postswitch = mkDpiSwitch {dpi = 150;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -106,8 +101,7 @@
|
||||||
${name} = asus-monitor;
|
${name} = asus-monitor;
|
||||||
eDP-1 = built-in;
|
eDP-1 = built-in;
|
||||||
};
|
};
|
||||||
config = with configs;
|
config = with configs; allOff // enableDevice name;
|
||||||
allOff // enableDevice name;
|
|
||||||
hooks.postswitch =
|
hooks.postswitch =
|
||||||
mkDpiSwitch {dpi = 110;}
|
mkDpiSwitch {dpi = 110;}
|
||||||
// mkBrightnessSwitch {
|
// mkBrightnessSwitch {
|
||||||
|
|
@ -117,9 +111,6 @@
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{default = frameworkBuiltin;}
|
{default = frameworkBuiltin;}
|
||||||
// genAttrs' allExternDevices (name: {
|
// genAttrs' allExternDevices (name: lib.nameValuePair "asus-${name}" (mkAsusProfile name));
|
||||||
name = "asus-${name}";
|
|
||||||
value = mkAsusProfile name;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue