diff --git a/configs/workout/packages.nix b/configs/workout/packages.nix index 2ab166b..9a9db7d 100644 --- a/configs/workout/packages.nix +++ b/configs/workout/packages.nix @@ -16,8 +16,4 @@ in { #nur.repos.mic92.nixos-shell ]; - programs.custom.q = { - enableIntelBacklight = false; - enableBattery = false; - }; } diff --git a/modules/default.nix b/modules/default.nix index 5b11173..f61bb8d 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -21,7 +21,6 @@ ./programs/espeak.nix ./programs/ffmpeg.nix ./programs/git.nix - ./programs/q.nix ./programs/shell-bash.nix ./programs/shell-tools.nix ./programs/shell-zsh.nix diff --git a/modules/programs/q.nix b/modules/programs/q.nix deleted file mode 100644 index 59717b9..0000000 --- a/modules/programs/q.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.programs.custom.q; - -in { - - options.programs.custom.q = { - enable = mkEnableOption "custom.programs.q"; - timeZones = mkOption { - default = [ "Europe/Berlin" ]; - type = with types; listOf str; - example = [ "Europe/Berlin" "Asia/Kolkata" "Asia/Singapore" ]; - }; - enableIntelBacklight = mkOption { - default = true; - type = with types; bool; - }; - enableBattery = mkOption { - default = true; - type = with types; bool; - }; - userHighlight = mkOption { - default = [ config.users.users.mainUser.name ]; - type = with types; listOf str; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ - (pkgs.q.override { - timeZones = cfg.timeZones; - enableIntelBacklight = cfg.enableIntelBacklight; - enableBattery = cfg.enableBattery; - userHighlight = cfg.userHighlight; - }) - ]; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 437b80d..1382cd9 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -37,8 +37,6 @@ in { emo = callPackage ./emoji { }; - q = callPackage ./q { }; - otpmenu = callPackage ./otpmenu { }; taskwarrior-hooks = callPackage ./taskwarrior-hooks { }; diff --git a/system/desktop/browser.nix b/system/desktop/browser.nix index 11e5d09..cf241e3 100644 --- a/system/desktop/browser.nix +++ b/system/desktop/browser.nix @@ -58,8 +58,4 @@ in { }; }; - # highlight browser users in q command - programs.custom.q.userHighlight = map ({ user, ... }: user) - (builtins.attrValues config.programs.custom.browser.configList); - } diff --git a/system/desktop/default.nix b/system/desktop/default.nix index b2e1040..5825316 100644 --- a/system/desktop/default.nix +++ b/system/desktop/default.nix @@ -24,6 +24,7 @@ ./x11.nix ./xlock.nix ./yubikey.nix + ./wtf.nix ]; programs.custom = { @@ -44,11 +45,6 @@ citate.enable = true; vim.enable = true; - q = { - enable = true; - timeZones = [ "Pacific/Auckland" "Europe/Berlin" "America/Los_Angeles" ]; - }; - }; services.urxvtd.enable = true; diff --git a/system/desktop/wtf.nix b/system/desktop/wtf.nix new file mode 100644 index 0000000..5a9c748 --- /dev/null +++ b/system/desktop/wtf.nix @@ -0,0 +1,208 @@ +{ pkgs, lib, config, ... }: +let + + unstable = import { }; + + activeTasks = pkgs.writers.writeBash "active-tasks" '' + ${pkgs.taskwarrior}/bin/task export +checklist status:pending +READY | \ + ${pkgs.jq}/bin/jq \ + --raw-output ' + sort_by(.description) | reverse | + .[] | + "[ \( .id ) ] \( .description )" + ' + echo + ${pkgs.taskwarrior}/bin/task export \ + +ACTIVE status:pending \ + | ${pkgs.jq}/bin/jq --raw-output '.[] | "⇒ \(.id) \(.description)"' + ''; + + userHighlight = map ({ user, ... }: user) + (builtins.attrValues config.programs.custom.browser.configList); + + activeUsers = pkgs.writers.writeBash "active-users" '' + ${pkgs.procps}/bin/ps -eo user \ + | ${pkgs.gnused}/bin/sed '1 d' \ + | ${pkgs.coreutils}/bin/sort \ + | ${pkgs.coreutils}/bin/uniq \ + | ${pkgs.gnugrep}/bin/egrep --color=always '(${ + pkgs.lib.concatStringsSep "|" userHighlight + })|$' + ''; + + qJson = { + wtf = { + + term = "rxvt-unicode-256color"; + + colors.border = { + focusable = "darkslateblue"; + focused = "orange"; + normal = "green"; + }; + + grid = { + columns = [ 33 40 36 0 ]; + rows = [ 9 3 7 6 0 ]; + }; + + refreshInterval = 1; + + mods = { + + digitalclock = { + title = ""; + type = "digitalclock"; + 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 = { + title = ""; + cpuCombined = false; + enabled = true; + position.top = 0; + position.left = 1; + position.height = 1; + position.width = 1; + refreshInterval = 5; + }; + + power = { + enabled = true; + position.top = 2; + position.left = 0; + position.height = 1; + position.width = 1; + refreshInterval = 100; + title = "Power"; + }; + + rates = { + type = "exchangerates"; + title = "rates"; + enabled = true; + focusable = false; + position.top = 3; + position.left = 0; + position.height = 1; + position.width = 1; + rates.NZD = [ "EUR" ]; + rates.EUR = [ "NZD" ]; + }; + + prettyweather = { + enabled = true; + title = ""; + city = "Wellington"; + position.top = 0; + position.left = 2; + position.height = 1; + position.width = 1; + unit = "m"; + view = 0; + language = "en"; + refreshInterval = 3600; + }; + + calendar = { + type = "cmdrunner"; + title = ""; + focusable = false; + args = [ "-3" "--monday" "--color=never" "-w" ]; + cmd = "cal"; + enabled = true; + position.top = 1; + position.left = 1; + position.height = 2; + position.width = 2; + refreshInterval = 3600; + }; + + uptime = { + type = "cmdrunner"; + title = "uptime"; + focusable = false; + cmd = "uptime"; + enabled = true; + position.top = 3; + position.left = 1; + position.height = 1; + position.width = 2; + refreshInterval = 3600; + }; + + active-users = { + type = "cmdrunner"; + title = "users"; + focusable = false; + cmd = activeUsers; + enabled = true; + position.top = 0; + position.left = 3; + position.height = 4; + position.width = 1; + refreshInterval = 300; + }; + + active-tasks = { + type = "cmdrunner"; + title = "active tasks"; + focusable = false; + cmd = activeTasks; + enabled = true; + position.top = 4; + position.left = 0; + position.height = 1; + position.width = 4; + refreshInterval = 3; + }; + }; + }; + }; + + qConfig = pkgs.writeText "config.yml" (builtins.toJSON qJson); + + q = pkgs.writers.writeBashBin "q" '' + ${unstable.wtf}/bin/wtfutil --config=${toString qConfig} + ''; +in { + + services.upower.enable = true; + + environment.systemPackages = [ + unstable.wtf + q + #activeUsers + #activeTasks + pkgs.upower + ]; + +}