mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
vanadium: rework autorandr config, take 2
This commit is contained in:
parent
5cc3105824
commit
ceff246f25
1 changed files with 18 additions and 25 deletions
|
|
@ -39,6 +39,8 @@
|
|||
allExternDevices =
|
||||
map (portNumber: "DP-${toString portNumber}") (lib.range 1 12);
|
||||
|
||||
allDevices = ["eDP-1"] ++ allExternDevices;
|
||||
|
||||
/**
|
||||
Generate an attribute set by mapping a function over a list of attribute names.
|
||||
It allows setting the name of the attribute.
|
||||
|
|
@ -55,19 +57,18 @@
|
|||
# Note: the "position" field corresponds to the "pos" field outputted by autorandr
|
||||
# To get the current config, run `xrandr --auto` and then `autorandr --config`
|
||||
configs = {
|
||||
allOff = genAttrs' allExternDevices (name: {
|
||||
allOff = genAttrs' allDevices (name: {
|
||||
inherit name;
|
||||
value = {enable = false;};
|
||||
});
|
||||
enableBuiltin = primary: {
|
||||
eDP-1 =
|
||||
{
|
||||
enableBuiltin = {
|
||||
eDP-1 = {
|
||||
enable = true;
|
||||
crtc = 0;
|
||||
mode = "2256x1504";
|
||||
rate = "60.00";
|
||||
}
|
||||
// lib.optionalAttrs primary {primary = true;};
|
||||
primary = true;
|
||||
};
|
||||
};
|
||||
enableDevice = name: {
|
||||
${name} = {
|
||||
|
|
@ -84,32 +85,24 @@
|
|||
frameworkBuiltin = {
|
||||
fingerprint.eDP-1 = built-in;
|
||||
config = with configs;
|
||||
allOff // enableBuiltin true;
|
||||
allOff // enableBuiltin;
|
||||
hooks.postswitch = mkExtSwitch {dpi = 150;};
|
||||
};
|
||||
|
||||
mkAsusProfile = name: withBuiltin: {
|
||||
mkAsusProfile = name: {
|
||||
fingerprint = {
|
||||
${name} = asus-monitor;
|
||||
eDP-1 = built-in;
|
||||
};
|
||||
config = with configs;
|
||||
allOff
|
||||
// enableDevice name
|
||||
// lib.optionalAttrs withBuiltin (enableBuiltin false);
|
||||
allOff // enableDevice name;
|
||||
hooks.postswitch = mkExtSwitch {dpi = 120;};
|
||||
};
|
||||
in
|
||||
genAttrs' allExternDevices (name: {
|
||||
name = "asus-${name}-builtin";
|
||||
value = mkAsusProfile name true;
|
||||
})
|
||||
{default = frameworkBuiltin;}
|
||||
// genAttrs' allExternDevices (name: {
|
||||
name = "asus-${name}-no-builtin";
|
||||
value = mkAsusProfile name false;
|
||||
})
|
||||
// {
|
||||
laptop = frameworkBuiltin;
|
||||
};
|
||||
name = "asus-${name}";
|
||||
value = mkAsusProfile name;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue