From 5b367986ee99f4d6f4cc0aff017aaaed54dc0295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Thu, 12 Mar 2026 17:53:37 +0100 Subject: [PATCH] fix(waybar): ssh module false positive and resizing --- waybar/scripts/ssh-session.sh | 8 ++++---- waybar/style.css | 11 ++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/waybar/scripts/ssh-session.sh b/waybar/scripts/ssh-session.sh index e6fc792..87acb8b 100755 --- a/waybar/scripts/ssh-session.sh +++ b/waybar/scripts/ssh-session.sh @@ -8,13 +8,13 @@ if [[ "$1" == "disconnect" ]]; then exit 0 fi -count=$(pgrep -cf 'sshd-session:.*@' 2>/dev/null || echo 0) +count=$(pgrep -cf 'sshd-session:.*@' 2>/dev/null) +count=${count:-0} if [[ "$count" -gt 0 ]]; then - # get remote session details sessions=$(who 2>/dev/null | awk '$NF ~ /\([0-9]/ {gsub(/[()]/, "", $NF); print $1 "@" $NF}') - tooltip=${sessions:-"$count remote sessions"} - # replace newlines with \n for valid JSON + label="session"; [[ "$count" -gt 1 ]] && label="sessions" + tooltip=${sessions:-"$count remote $label"} tooltip=${tooltip//$'\n'/\\n} tooltip=${tooltip//\"/\\\"} printf '{"text": "●", "class": "active", "tooltip": "%s"}\n' "$tooltip" diff --git a/waybar/style.css b/waybar/style.css index 333668c..822dd1e 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -25,6 +25,7 @@ window#waybar { background-color: @bg_dim; color: @fg; + min-height: 30px; } window#waybar.hidden { @@ -100,9 +101,17 @@ button:hover { } /* center: alert zone */ +#custom-ssh { + min-height: 0; + padding-top: 0; + padding-bottom: 0; + margin-top: 3px; + margin-bottom: 3px; +} + #custom-ssh.active { color: @cyan; - font-size: 20px; + font-size: 10px; } #custom-notification.notification {