wtf: further improvements
This commit is contained in:
parent
c7ee7d395a
commit
fe231d26b3
1 changed files with 52 additions and 9 deletions
|
@ -3,6 +3,38 @@ let
|
||||||
|
|
||||||
unstable = import <nixpkgs-unstable> { };
|
unstable = import <nixpkgs-unstable> { };
|
||||||
|
|
||||||
|
networkStatus = let
|
||||||
|
|
||||||
|
q-online = ''
|
||||||
|
if ${pkgs.curl}/bin/curl -s google.com >/dev/null; then
|
||||||
|
echo 'status: [32;1monline[m'
|
||||||
|
else
|
||||||
|
echo 'status: offline '
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
q-wireless = ''
|
||||||
|
for dev in $(
|
||||||
|
${pkgs.iw}/bin/iw dev \
|
||||||
|
| ${pkgs.gnused}/bin/sed -n 's/^\s*Interface\s\+\([0-9a-z]\+\)$/\1/p'
|
||||||
|
); do
|
||||||
|
inet=$(${pkgs.iproute}/bin/ip addr show $dev \
|
||||||
|
| ${pkgs.gnused}/bin/sed -n 's/.*inet \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p') \
|
||||||
|
|| unset inet
|
||||||
|
ssid=$(${pkgs.iw}/bin/iw dev $dev link \
|
||||||
|
| ${pkgs.gnused}/bin/sed -n 's/.*\tSSID: \(.*\)/\1/p' \
|
||||||
|
| ${pkgs.coreutils}/bin/tr -d '\r') \
|
||||||
|
|| unset ssid
|
||||||
|
printf '%s: %s %s\n' $dev ''${inet+ $inet} ''${ssid+ $ssid}
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
in pkgs.writers.writeBash "network-status" ''
|
||||||
|
${q-wireless}
|
||||||
|
${q-online}
|
||||||
|
${pkgs.coreutils}/bin/uptime
|
||||||
|
'';
|
||||||
|
|
||||||
taskNextWeek = pkgs.writers.writeDash "taskweek" ''
|
taskNextWeek = pkgs.writers.writeDash "taskweek" ''
|
||||||
${pkgs.taskwarrior}/bin/task \
|
${pkgs.taskwarrior}/bin/task \
|
||||||
export \
|
export \
|
||||||
|
@ -183,15 +215,6 @@ let
|
||||||
refreshInterval = 3600;
|
refreshInterval = 3600;
|
||||||
};
|
};
|
||||||
|
|
||||||
uptime = cmdRunner {
|
|
||||||
title = "uptime";
|
|
||||||
cmd = "uptime";
|
|
||||||
top = 3;
|
|
||||||
left = 1;
|
|
||||||
height = 1;
|
|
||||||
width = 3;
|
|
||||||
};
|
|
||||||
|
|
||||||
active-users = cmdRunner {
|
active-users = cmdRunner {
|
||||||
title = "users";
|
title = "users";
|
||||||
cmd = activeUsers;
|
cmd = activeUsers;
|
||||||
|
@ -221,6 +244,26 @@ let
|
||||||
width = 2;
|
width = 2;
|
||||||
refreshInterval = 60;
|
refreshInterval = 60;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
network-status = cmdRunner {
|
||||||
|
title = "network status";
|
||||||
|
cmd = networkStatus;
|
||||||
|
top = 3;
|
||||||
|
left = 1;
|
||||||
|
height = 1;
|
||||||
|
width = 3;
|
||||||
|
refreshInterval = 60;
|
||||||
|
};
|
||||||
|
|
||||||
|
uptime = cmdRunner {
|
||||||
|
enabled = false;
|
||||||
|
title = "uptime";
|
||||||
|
cmd = "uptime";
|
||||||
|
top = 3;
|
||||||
|
left = 1;
|
||||||
|
height = 1;
|
||||||
|
width = 3;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue