From 4efc31f5f738f970bc203c1fbd37e0705f3eec76 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 10 Jan 2020 23:54:09 +1300 Subject: [PATCH] wtf: add news dashboard --- system/desktop/wtf.nix | 117 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 107 insertions(+), 10 deletions(-) diff --git a/system/desktop/wtf.nix b/system/desktop/wtf.nix index fcf80f5..877b042 100644 --- a/system/desktop/wtf.nix +++ b/system/desktop/wtf.nix @@ -146,26 +146,115 @@ let refreshInterval = 3600; } // 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 = { - term = "rxvt-unicode-256color"; - colors.border = { focusable = "darkslateblue"; focused = "orange"; 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 = { columns = [ 33 12 28 36 0 ]; rows = [ 9 3 7 6 0 ]; }; - refreshInterval = 1; - mods = with modules; { 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 { services.upower.enable = true; environment.systemPackages = [ unstable.wtf - q + (createDashboard { + json = qJson; + name = "q"; + }) + (createDashboard { + json = newsJson; + name = "news"; + }) #activeUsers #activeTasks pkgs.upower