parent
5263fe4594
commit
99f0074362
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
attrByPath attrNames concatMap concatMapStringsSep elem filter filterAttrs
|
any attrByPath attrNames concatMap concatMapStringsSep elem filter
|
||||||
flip foldl' hasPrefix mergeAttrs optionalAttrs stringLength subtractLists
|
filterAttrs flip foldl' hasPrefix mergeAttrs optionalAttrs removePrefix
|
||||||
types unique;
|
stringLength subtractLists types unique;
|
||||||
inherit (lib.options) literalExample mkEnableOption mkOption;
|
inherit (lib.options) literalExample mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@ let
|
||||||
|
|
||||||
jsonFormat = pkgs.formats.json { };
|
jsonFormat = pkgs.formats.json { };
|
||||||
|
|
||||||
# Taken from <https://github.com/Alexays/Waybar/blob/adaf84304865e143e4e83984aaea6f6a7c9d4d96/src/factory.cpp>
|
# Taken from <https://github.com/Alexays/Waybar/blob/cc3acf8102c71d470b00fd55126aef4fb335f728/src/factory.cpp> (2020/10/10)
|
||||||
|
# Order is preserved from the file for easier matching
|
||||||
defaultModuleNames = [
|
defaultModuleNames = [
|
||||||
|
"battery"
|
||||||
"sway/mode"
|
"sway/mode"
|
||||||
"sway/workspaces"
|
"sway/workspaces"
|
||||||
"sway/window"
|
"sway/window"
|
||||||
|
@ -36,11 +38,15 @@ let
|
||||||
"sndio"
|
"sndio"
|
||||||
"temperature"
|
"temperature"
|
||||||
"bluetooth"
|
"bluetooth"
|
||||||
"battery"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Allow specifying a CSS class after the default module name
|
||||||
|
isValidDefaultModuleName = x:
|
||||||
|
any (name: hasPrefix name x && hasPrefix "#" (removePrefix name x))
|
||||||
|
defaultModuleNames;
|
||||||
|
|
||||||
isValidCustomModuleName = x:
|
isValidCustomModuleName = x:
|
||||||
elem x defaultModuleNames || (hasPrefix "custom/" x && stringLength x > 7);
|
hasPrefix "custom/" x && stringLength x > 7 || isValidDefaultModuleName x;
|
||||||
|
|
||||||
margins = let
|
margins = let
|
||||||
mkMargin = name: {
|
mkMargin = name: {
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
"memory",
|
"memory",
|
||||||
"backlight",
|
"backlight",
|
||||||
"tray",
|
"tray",
|
||||||
"battery",
|
"battery#bat1",
|
||||||
|
"battery#bat2",
|
||||||
"clock"
|
"clock"
|
||||||
],
|
],
|
||||||
"output": [
|
"output": [
|
||||||
|
|
|
@ -24,7 +24,8 @@ in {
|
||||||
"memory"
|
"memory"
|
||||||
"backlight"
|
"backlight"
|
||||||
"tray"
|
"tray"
|
||||||
"battery"
|
"battery#bat1"
|
||||||
|
"battery#bat2"
|
||||||
"clock"
|
"clock"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue