1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

fix(i3status-rust): offline behaviour

This commit is contained in:
2022-08-30 19:33:07 +02:00
parent 4fe122f06c
commit 6cf3072609

View File

@@ -113,17 +113,17 @@ in {
block = "custom"; block = "custom";
interval = 60 * 5; interval = 60 * 5;
command = let command = let
query-account = name: account: query-account = name: account: "${pkgs.writers.writeDash "query-imap-${name}" ''
pkgs.writers.writeDash "query-imap-${name}" '' ${pkgs.coreutils}/bin/timeout 1 ${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg "${account.user}:${account.password}"} imaps://${account.imap} -X 'STATUS INBOX (UNSEEN)' \
${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg "${account.user}:${account.password}"} imaps://${account.imap} -X 'STATUS INBOX (UNSEEN)' \ | ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+' \
| ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+' \ | sed 's/^/{"${name}":/;s/$/}/'
| sed 's/^/{"${name}":/;s/$/}/' ''} &";
'';
in in
pkgs.writers.writeDash "unread-mail" '' pkgs.writers.writeDash "unread-mail" ''
{ {
${lib.concatStringsSep "\n" (lib.mapAttrsToList query-account accounts)} ${lib.concatStringsSep "\n" (lib.mapAttrsToList query-account accounts)}
} | jq -s ' wait
} | jq -s 'if length == 0 then {text: "", icon: "mail", state: "Idle"} else
add add
| (values | add) as $sum | (values | add) as $sum
| { | {
@@ -138,7 +138,7 @@ in {
"Idle" "Idle"
end end
) )
}' } end'
''; '';
json = true; json = true;
hide_when_empty = true; hide_when_empty = true;
@@ -147,7 +147,7 @@ in {
block = "custom"; block = "custom";
interval = 60; interval = 60;
command = pkgs.writers.writeDash "weechat" '' command = pkgs.writers.writeDash "weechat" ''
ssh makanek cat /var/lib/weechat/hotlist.txt | sed 's/,/\n/g' | wc -l | jq '{ ssh -o ConnectTimeout=1 makanek cat /var/lib/weechat/hotlist.txt | sed 's/,/\n/g' | wc -l | jq '{
text: (if . > 0 then . | tostring else "" end), text: (if . > 0 then . | tostring else "" end),
state: (if . > 0 then "Info" else "Idle" end), state: (if . > 0 then "Info" else "Idle" end),
icon: "irc" icon: "irc"