mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-22 18:29:39 +01:00
hyprland: add option for per-input device configs
This commit is contained in:
parent
a500de54b2
commit
49a266d2ca
3 changed files with 30 additions and 3 deletions
|
|
@ -207,23 +207,41 @@ in {
|
|||
let
|
||||
indent = concatStrings (replicate indentLevel " ");
|
||||
|
||||
sections = filterAttrs (n: v: isAttrs v && n != "device") attrs;
|
||||
|
||||
mkSection = n: attrs: ''
|
||||
${indent}${n} {
|
||||
${toHyprconf attrs (indentLevel + 1)}${indent}}
|
||||
'';
|
||||
sections = filterAttrs (n: v: isAttrs v) attrs;
|
||||
|
||||
mkDeviceCategory = device: ''
|
||||
${indent}device {
|
||||
name=${device.name}
|
||||
${
|
||||
toHyprconf (filterAttrs (n: _: "name" != n) device)
|
||||
(indentLevel + 1)
|
||||
}${indent}}
|
||||
'';
|
||||
|
||||
deviceCategory = lib.optionalString (hasAttr "device" attrs)
|
||||
(if isList attrs.device then
|
||||
(concatMapStringsSep "\n" (d: mkDeviceCategory d) attrs.device)
|
||||
else
|
||||
mkDeviceCategory attrs.device);
|
||||
|
||||
mkFields = generators.toKeyValue {
|
||||
listsAsDuplicateKeys = true;
|
||||
inherit indent;
|
||||
};
|
||||
allFields = filterAttrs (n: v: !(isAttrs v)) attrs;
|
||||
allFields = filterAttrs (n: v: !(isAttrs v) && n != "device") attrs;
|
||||
|
||||
importantFields = filterAttrs (n: _:
|
||||
(hasPrefix "$" n) || (hasPrefix "bezier" n)
|
||||
|| (cfg.sourceFirst && (hasPrefix "source" n))) allFields;
|
||||
|
||||
fields = builtins.removeAttrs allFields
|
||||
(mapAttrsToList (n: _: n) importantFields);
|
||||
in mkFields importantFields
|
||||
in mkFields importantFields + deviceCategory
|
||||
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
|
||||
+ mkFields fields;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue