mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-22 05:14:42 +01:00
document kmscon functions
This commit is contained in:
parent
6394e8d8a0
commit
ac227aa765
|
@ -4,6 +4,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
# generate shell command options for kmscon fom an attrset
|
||||||
generateOptions = with builtins; (
|
generateOptions = with builtins; (
|
||||||
opts:
|
opts:
|
||||||
toString (
|
toString (
|
||||||
|
@ -12,10 +13,12 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
# generate a hexadecimal number lookup table to get integers from them
|
||||||
hexLookupTable = with lib; (listToAttrs (genList (i: {
|
hexLookupTable = with lib; (listToAttrs (genList (i: {
|
||||||
name = let
|
name = let
|
||||||
r = toHexString i;
|
r = toHexString i;
|
||||||
in (
|
in (
|
||||||
|
# pad with 0 in front if only 1 digit
|
||||||
if (stringLength r) == 1
|
if (stringLength r) == 1
|
||||||
then "0${r}"
|
then "0${r}"
|
||||||
else r
|
else r
|
||||||
|
@ -23,6 +26,7 @@
|
||||||
value = toString i;
|
value = toString i;
|
||||||
})
|
})
|
||||||
256));
|
256));
|
||||||
|
# "parse" hex color strings and convert them to kmscon options
|
||||||
hexToOpt = with lib; (color:
|
hexToOpt = with lib; (color:
|
||||||
concatStringsSep "," [
|
concatStringsSep "," [
|
||||||
(getAttr (substring 1 2 (toUpper color)) hexLookupTable)
|
(getAttr (substring 1 2 (toUpper color)) hexLookupTable)
|
||||||
|
|
Loading…
Reference in a new issue