diff options
author | Botond Hende <nettingman@gmail.com> | 2024-04-14 06:38:49 +0200 |
---|---|---|
committer | Botond Hende <nettingman@gmail.com> | 2024-04-14 06:38:49 +0200 |
commit | 0221492f62bcc1b766c2a4d5dbe26f6ff2ed8bc2 (patch) | |
tree | f91b7ada571a4dab7ae99c8f3ee252616baff2db /home/.selfconfigs/waybar |
squashed init
Diffstat (limited to 'home/.selfconfigs/waybar')
-rw-r--r-- | home/.selfconfigs/waybar/sshd_poll | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/home/.selfconfigs/waybar/sshd_poll b/home/.selfconfigs/waybar/sshd_poll new file mode 100644 index 0000000..723af9e --- /dev/null +++ b/home/.selfconfigs/waybar/sshd_poll @@ -0,0 +1,10 @@ +#!/bin/bash -eu + +lines=$(who | grep pts | grep -Ev "\(:pts") +if [[ -z "$lines" ]]; then + printf '{"text":"No SSH connections", "tooltip":"No SSH connections", "class":"normal"}' +else + line_count=$(echo "$lines" | wc --lines) + lines="${lines/$'\n'/\\\\n}" + printf '{"text":"'"$line_count"' SSH connection(s)", "tooltip":"'"$lines"'", "class":"active"}' +fi |