Skip to content

Commit

Permalink
Move string padding logic
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Gill <[email protected]>
  • Loading branch information
rrobgill committed Feb 26, 2025
1 parent 9f7c97f commit 6ae23eb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,11 @@ GenerateSizeDependendOutput() {
top_domain=$(truncateString "$top_domain_raw" 48)
top_client=$(truncateString "$top_client_raw" 48)

if [ "$temp_unicode" = true ]; then
temp_padding=21
else
temp_padding=20
fi

elif [ "$1" = "mega" ]; then
ads_blocked_bar=$(BarGenerator "$ads_percentage_today" 30 "color")
Expand All @@ -931,6 +936,12 @@ GenerateSizeDependendOutput() {
top_domain=$(truncateString "$top_domain_raw" 68)
top_client=$(truncateString "$top_client_raw" 68)

if [ "$temp_unicode" = true ]; then
temp_padding=10
else
temp_padding=9
fi

fi

# System uptime
Expand Down Expand Up @@ -1153,11 +1164,6 @@ PrintDashboard() {
elif [ "$1" = "regular" ] || [ "$1" = "slim" ]; then
# slim is a screen with at least 60 columns and exactly 21 lines
# regular is a screen at least 60x22 (columns x lines)
if [ "$temp_unicode" = true ]; then
temp_padding=21
else
temp_padding=20
fi
if [ "$1" = "slim" ]; then
moveXOffset; printf "%s${clear_line}\n" "${padd_text}${dim_text}slim${reset_text} ${version_info}${reset_text}"
moveXOffset; printf "%s${clear_line}\n" " PADD ${padd_version_heatmap}${padd_version}${reset_text} ${full_status}${reset_text}"
Expand Down Expand Up @@ -1188,11 +1194,6 @@ PrintDashboard() {
moveXOffset; printf " %-10s[${memory_heatmap}%-10s${reset_text}] %-6s %-10s[${cpu_load_1_heatmap}%-10s${reset_text}] %-5s${clear_line}" "Memory:" "${memory_bar}" "${memory_percent}%" "CPU Load:" "${cpu_bar}" "${cpu_percent}%"
else # ${padd_size} = mega
# mega is a screen with at least 80 columns and 26 lines
if [ "$temp_unicode" = true ]; then
temp_padding=10
else
temp_padding=9
fi
moveXOffset; printf "%s${clear_line}\n" "${padd_logo_retro_1}"
moveXOffset; printf "%s${clear_line}\n" "${padd_logo_retro_2} ${version_info}, PADD ${padd_version_heatmap}${padd_version}${reset_text}"
moveXOffset; printf "%s${clear_line}\n" "${padd_logo_retro_3} ${dns_check_box} DNS ${ftl_check_box} FTL ${mega_status}${reset_text}"
Expand Down

0 comments on commit 6ae23eb

Please sign in to comment.