wtf: add news dashboard

This commit is contained in:
Ingolf Wagner 2020-01-10 23:54:09 +13:00
parent a69e393644
commit 4efc31f5f7
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -146,26 +146,115 @@ let
refreshInterval = 3600; refreshInterval = 3600;
} // args); } // args);
feedreader = args@{ top, left, feeds, ... }:
wtfModule ({
type = "feedreader";
title = "";
#refreshInterval = 3600;
focusable = true;
#feedLimit = 10;
colors.rows = {
even = "white";
odd = "white";
};
} // args);
github = args@{ top, left, username, apiKey, ... }:
wtfModule ({
type = "github";
title = "";
refreshInterval = 3600;
feedlimit = 10;
enableStatus = true;
# customQueries:
# othersPRs:
# title: "Others Pull Requests"
# filter: "is:open is:pr -author:wtfutil"
# repositories:
# - "wtfutil/wtf"
# - "wtfutil/docs"
# - "umbrella-corp/wesker-api"
} // args);
}; };
qJson = { newsJson = {
wtf = { wtf = {
term = "rxvt-unicode-256color"; term = "rxvt-unicode-256color";
colors.border = { colors.border = {
focusable = "darkslateblue"; focusable = "darkslateblue";
focused = "orange"; focused = "orange";
normal = "green"; normal = "green";
}; };
grid = {
columns = [ 28 0 ];
rows = [ 9 9 9 9 9 9 0 ];
};
refreshInterval = 1;
mods = with modules; {
clock = cmdRunner {
cmd = pkgs.writers.writeDash "clock" ''
${pkgs.figlet}/bin/figlet -f smslant `date +%H:%M`
'';
title = "clock";
top = 0;
left = 0;
refreshInterval = 30;
};
weather = prettyweather {
top = 1;
left = 0;
};
# feeds
hackernews = feedreader {
title = "Hacker News";
top = 0;
left = 1;
height = 2;
feeds = [ "https://news.ycombinator.com/rss" ];
};
nixos = feedreader {
title = "NixOS Weekly";
top = 2;
left = 1;
height = 1;
feeds = [ "https://weekly.nixos.org/feeds/all.rss.xml" ];
};
taskwarrior = feedreader {
title = "Taskwarrior";
top = 3;
left = 1;
height = 1;
feeds = [ "https://taskwarrior.org/feed.rss" ];
};
#github = github {
# username = "mrVanDalo";
# apiKey = "";
# repositories = [
# "nixos/nixpkgs"
# ];
#};
};
};
};
qJson = {
wtf = {
term = "rxvt-unicode-256color";
colors.border = {
focusable = "darkslateblue";
focused = "orange";
normal = "green";
};
grid = { grid = {
columns = [ 33 12 28 36 0 ]; columns = [ 33 12 28 36 0 ];
rows = [ 9 3 7 6 0 ]; rows = [ 9 3 7 6 0 ];
}; };
refreshInterval = 1; refreshInterval = 1;
mods = with modules; { mods = with modules; {
digitalclock = digitalclock { digitalclock = digitalclock {
@ -268,18 +357,26 @@ let
}; };
}; };
qConfig = pkgs.writeText "config.yml" (builtins.toJSON qJson); createDashboard = { json, name }:
let configuration = pkgs.writeText "config.yml" (builtins.toJSON json);
in pkgs.writers.writeBashBin name ''
${unstable.wtf}/bin/wtfutil --config=${toString configuration}
'';
q = pkgs.writers.writeBashBin "q" ''
${unstable.wtf}/bin/wtfutil --config=${toString qConfig}
'';
in { in {
services.upower.enable = true; services.upower.enable = true;
environment.systemPackages = [ environment.systemPackages = [
unstable.wtf unstable.wtf
q (createDashboard {
json = qJson;
name = "q";
})
(createDashboard {
json = newsJson;
name = "news";
})
#activeUsers #activeUsers
#activeTasks #activeTasks
pkgs.upower pkgs.upower