wtf: replaced q command with wtfutil

This commit is contained in:
Ingolf Wagner 2020-01-07 02:36:38 +13:00
parent 73bcccafa9
commit 6f3d5570d9
Signed by: palo
GPG key ID: 76BF5F1928B9618B
7 changed files with 209 additions and 58 deletions

View file

@ -16,8 +16,4 @@ in {
#nur.repos.mic92.nixos-shell
];
programs.custom.q = {
enableIntelBacklight = false;
enableBattery = false;
};
}

View file

@ -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

View file

@ -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;
})
];
};
}

View file

@ -37,8 +37,6 @@ in {
emo = callPackage ./emoji { };
q = callPackage ./q { };
otpmenu = callPackage ./otpmenu { };
taskwarrior-hooks = callPackage ./taskwarrior-hooks { };

View file

@ -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);
}

View file

@ -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;

208
system/desktop/wtf.nix Normal file
View file

@ -0,0 +1,208 @@
{ pkgs, lib, config, ... }:
let
unstable = import <nixpkgs-unstable> { };
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
];
}