hyprland: add option for per-input device configs
This commit is contained in:
parent
a500de54b2
commit
49a266d2ca
|
@ -207,23 +207,41 @@ in {
|
||||||
let
|
let
|
||||||
indent = concatStrings (replicate indentLevel " ");
|
indent = concatStrings (replicate indentLevel " ");
|
||||||
|
|
||||||
|
sections = filterAttrs (n: v: isAttrs v && n != "device") attrs;
|
||||||
|
|
||||||
mkSection = n: attrs: ''
|
mkSection = n: attrs: ''
|
||||||
${indent}${n} {
|
${indent}${n} {
|
||||||
${toHyprconf attrs (indentLevel + 1)}${indent}}
|
${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 {
|
mkFields = generators.toKeyValue {
|
||||||
listsAsDuplicateKeys = true;
|
listsAsDuplicateKeys = true;
|
||||||
inherit indent;
|
inherit indent;
|
||||||
};
|
};
|
||||||
allFields = filterAttrs (n: v: !(isAttrs v)) attrs;
|
allFields = filterAttrs (n: v: !(isAttrs v) && n != "device") attrs;
|
||||||
|
|
||||||
importantFields = filterAttrs (n: _:
|
importantFields = filterAttrs (n: _:
|
||||||
(hasPrefix "$" n) || (hasPrefix "bezier" n)
|
(hasPrefix "$" n) || (hasPrefix "bezier" n)
|
||||||
|| (cfg.sourceFirst && (hasPrefix "source" n))) allFields;
|
|| (cfg.sourceFirst && (hasPrefix "source" n))) allFields;
|
||||||
|
|
||||||
fields = builtins.removeAttrs allFields
|
fields = builtins.removeAttrs allFields
|
||||||
(mapAttrsToList (n: _: n) importantFields);
|
(mapAttrsToList (n: _: n) importantFields);
|
||||||
in mkFields importantFields
|
in mkFields importantFields + deviceCategory
|
||||||
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
|
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
|
||||||
+ mkFields fields;
|
+ mkFields fields;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ bezier=smoothOut, 0.36, 0, 0.66, -0.56
|
||||||
bezier=smoothIn, 0.25, 1, 0.5, 1
|
bezier=smoothIn, 0.25, 1, 0.5, 1
|
||||||
bezier=overshot, 0.4,0.8,0.2,1.2
|
bezier=overshot, 0.4,0.8,0.2,1.2
|
||||||
source=sourced.conf
|
source=sourced.conf
|
||||||
|
device {
|
||||||
|
name=some:device
|
||||||
|
enable=true
|
||||||
|
}
|
||||||
animations {
|
animations {
|
||||||
animation=border, 1, 2, smoothIn
|
animation=border, 1, 2, smoothIn
|
||||||
animation=fade, 1, 4, smoothOut
|
animation=fade, 1, 4, smoothOut
|
||||||
|
|
|
@ -46,6 +46,11 @@
|
||||||
"$mod ALT, mouse:272, resizewindow"
|
"$mod ALT, mouse:272, resizewindow"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
device = {
|
||||||
|
name = "some:device";
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
plugin = {
|
plugin = {
|
||||||
plugin1 = {
|
plugin1 = {
|
||||||
dummy = "plugin setting";
|
dummy = "plugin setting";
|
||||||
|
|
Loading…
Reference in a new issue