From 295dfad33e27655b8870b08080339cbcac8d2894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Tue, 18 May 2021 20:38:26 +0200 Subject: [PATCH] feat(i3status-rust): add netdevice indicator --- lib/i3status-rust.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/i3status-rust.nix b/lib/i3status-rust.nix index 75e805a..ed36491 100644 --- a/lib/i3status-rust.nix +++ b/lib/i3status-rust.nix @@ -102,6 +102,22 @@ in { echo "$mail_count" ''; } + (let service = "openvpn-hu-berlin"; in { + block = "custom"; + interval = 5; + command = pkgs.writers.writeDash "net-device" '' + PATH=${lib.makeBinPath [ pkgs.systemd ]} + systemctl is-active --quiet ${service}.service && echo "🎓👍" || echo "🎓👎" + ''; + on_click = pkgs.writers.writeDash "toggle" '' + PATH=${lib.makeBinPath [ pkgs.systemd pkgs.libnotify ]} + systemctl is-active --quiet ${service}.service && { + systemctl stop ${service}.service && notify-send -a "${service}" stopped + } || { + systemctl start ${service}.service && notify-send -a "${service}" started + } + ''; + }) { block = "net"; device = wirelessInterface;