wtf: a bit easier to crate new dashboards now

This commit is contained in:
Ingolf Wagner 2020-01-07 12:07:17 +13:00
parent 10919f7caa
commit 7b319051db
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -30,6 +30,84 @@ let
})|$' })|$'
''; '';
# default settings
wtfModule =
args@{ height ? 1, width ? 1, top, left, enabled ? true, type, ... }:
{
enabled = enabled;
focusable = false;
position.top = top;
position.left = left;
position.height = height;
position.width = width;
} // (lib.filterAttrs
(key: _: lib.all (x: x != key) [ "height" "width" "top" "left" ]) args);
modules = {
# command runner module
cmdRunner = args@{ cmd, ... }:
wtfModule ({
type = "cmdrunner";
focusable = false;
refreshInterval = 300;
} // args);
digitalclock = args@{ top, left, ... }:
wtfModule ({
type = "digitalclock";
title = "";
color = "white";
font = "bigfont";
hourFormat = 24;
refreshInterval = 1;
} // args);
clocks = args@{ top, left, ... }:
wtfModule ({
type = "clocks";
title = "";
border = false;
colors.rows = {
even = "white";
odd = "white";
};
locations = {
Berlin = "Europe/Berlin";
Wellington = "Pacific/Auckland";
};
sort = "alphabetical";
refreshInterval = 60;
} // args);
resourceusage = args@{ top, left, ... }:
wtfModule ({
type = "resourceusage";
title = "";
cpuCombined = false;
refreshInterval = 5;
} // args);
power = args@{ top, left, ... }:
wtfModule ({
type = "power";
title = "";
refreshInterval = 100;
} // args);
prettyweather = args@{ top, left, ... }:
wtfModule ({
type = "prettyweather";
title = "";
city = "Wellington";
unit = "m";
view = 0;
language = "en";
refreshInterval = 3600;
} // args);
};
qJson = { qJson = {
wtf = { wtf = {
@ -48,140 +126,79 @@ let
refreshInterval = 1; refreshInterval = 1;
mods = { mods = with modules; {
digitalclock = { digitalclock = digitalclock {
title = ""; top = 0;
type = "digitalclock"; left = 0;
enabled = true;
color = "white";
font = "bigfont";
hourFormat = 24;
refreshInterval = 1;
position.top = 0;
position.left = 0;
position.height = 1;
position.width = 1;
};
clocks = {
title = "";
type = "clocks";
enabled = true;
border = false;
colors.rows = {
even = "white";
odd = "white";
};
locations = {
Berlin = "Europe/Berlin";
Wellington = "Pacific/Auckland";
};
sort = "alphabetical";
position.top = 1;
position.left = 0;
position.height = 1;
position.width = 1;
refreshInterval = 60;
}; };
resourceusage = { clocks = clocks {
title = ""; top = 1;
cpuCombined = false; left = 0;
enabled = true;
position.top = 0;
position.left = 1;
position.height = 1;
position.width = 1;
refreshInterval = 5;
}; };
power = { top = resourceusage {
enabled = true; top = 0;
position.top = 2; left = 1;
position.left = 0;
position.height = 1;
position.width = 1;
refreshInterval = 100;
title = "Power";
}; };
rates = { power = power {
top = 2;
left = 0;
};
rates = wtfModule {
type = "exchangerates"; type = "exchangerates";
top = 3;
left = 0;
title = "rates"; title = "rates";
enabled = true;
focusable = false;
position.top = 3;
position.left = 0;
position.height = 1;
position.width = 1;
rates.NZD = [ "EUR" ]; rates.NZD = [ "EUR" ];
rates.EUR = [ "NZD" ]; rates.EUR = [ "NZD" ];
}; };
prettyweather = { weather = prettyweather {
enabled = true; top = 0;
title = ""; left = 2;
city = "Wellington";
position.top = 0;
position.left = 2;
position.height = 1;
position.width = 1;
unit = "m";
view = 0;
language = "en";
refreshInterval = 3600;
}; };
calendar = { calendar = cmdRunner {
type = "cmdrunner";
title = ""; title = "";
focusable = false;
args = [ "-3" "--monday" "--color=never" "-w" ]; args = [ "-3" "--monday" "--color=never" "-w" ];
cmd = "cal"; cmd = "cal";
enabled = true; top = 1;
position.top = 1; left = 1;
position.left = 1; height = 2;
position.height = 2; width = 2;
position.width = 2;
refreshInterval = 3600; refreshInterval = 3600;
}; };
uptime = { uptime = cmdRunner {
type = "cmdrunner";
title = "uptime"; title = "uptime";
focusable = false;
cmd = "uptime"; cmd = "uptime";
enabled = true; top = 3;
position.top = 3; left = 1;
position.left = 1; height = 1;
position.height = 1; width = 2;
position.width = 2;
refreshInterval = 300;
}; };
active-users = { active-users = cmdRunner {
type = "cmdrunner";
title = "users"; title = "users";
focusable = false;
cmd = activeUsers; cmd = activeUsers;
enabled = true; top = 0;
position.top = 0; left = 3;
position.left = 3; height = 4;
position.height = 4; width = 1;
position.width = 1;
refreshInterval = 30; refreshInterval = 30;
}; };
active-tasks = { active-tasks = cmdRunner {
type = "cmdrunner";
title = "active tasks"; title = "active tasks";
focusable = false;
cmd = activeTasks; cmd = activeTasks;
enabled = true; top = 4;
position.top = 4; left = 0;
position.left = 0; height = 1;
position.height = 1; width = 4;
position.width = 4;
refreshInterval = 60; refreshInterval = 60;
}; };
}; };