diff --git a/dotmatrix.theme b/dotmatrix.theme index 23b5212..f181683 100644 --- a/dotmatrix.theme +++ b/dotmatrix.theme @@ -786,8 +786,17 @@ __dotmatrix_activate_hostname() { if _lp_hostname; then case "$lp_connection" in ssh) + local client_ip client_port server_ip server_port hostname= + IFS=" " read -r client_ip client_port server_ip server_port <<<"$SSH_CONNECTION" + local username=${USER:-${USERNAME:-${LOGNAME-}}} + if _lp_create_link "ssh://${username}@${server_ip}:${server_port}" "$lp_hostname"; then + hostname="$link" + else + hostname="$lp_hostname" + fi + # If we want a different color for each host (( LP_ENABLE_SSH_COLORS )) && LP_COLOR_SSH="$LP_COLOR_HOST_HASH" - hostname="${LP_COLOR_SSH}${lp_hostname}" + hostname="${LP_COLOR_SSH}${hostname}" ;; tel) hostname="${lp_hostname}"