fix(waybar): ssh module false positive and resizing

This commit is contained in:
2026-03-12 17:53:37 +01:00
parent af42a00659
commit 5b367986ee
2 changed files with 14 additions and 5 deletions

View File

@@ -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"

View File

@@ -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 {