More aesthetic tweaks
This commit is contained in:
1 parent
c8a0072403
commit
c303a9f746
1 file changed
+20
-15
@@ -185,7 +185,7 @@ progress_bar() {
|
|||||||
(( pct > 100 )) && pct=100
|
(( pct > 100 )) && pct=100
|
||||||
filled=$(( pct * width / 100 ))
|
filled=$(( pct * width / 100 ))
|
||||||
empty=$(( width - filled ))
|
empty=$(( width - filled ))
|
||||||
printf '%s%s%s%s%s %3d%%' "$GREEN" "$(repeat █ "$filled")" "$DARK" "$(repeat ░ "$empty")" "$RESET" "$pct"
|
printf '%s%s%s%s%s' "$GREEN" "$(repeat █ "$filled")" "$DARK" "$(repeat ░ "$empty")" "$RESET"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_progress() {
|
install_progress() {
|
||||||
@@ -245,24 +245,21 @@ render_static() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_dynamic() {
|
render_dynamic() {
|
||||||
local frame="$1" pct spin
|
local frame="$1" pct
|
||||||
pct="$(install_progress)"
|
pct="$(install_progress)"
|
||||||
[[ $pct =~ ^[0-9]+$ ]] || pct=$LAST_PCT
|
[[ $pct =~ ^[0-9]+$ ]] || pct=$LAST_PCT
|
||||||
(( pct > 100 )) && pct=100
|
(( pct > 100 )) && pct=100
|
||||||
(( pct < LAST_PCT )) && pct=$LAST_PCT
|
(( pct < LAST_PCT )) && pct=$LAST_PCT
|
||||||
LAST_PCT=$pct
|
LAST_PCT=$pct
|
||||||
spin=("◐" "◓" "◑" "◒")
|
|
||||||
|
|
||||||
printf '%s%d;1H' "$CSI" "$DYNAMIC_ROW"
|
printf '%s%d;1H' "$CSI" "$DYNAMIC_ROW"
|
||||||
center "Installing Omarchy" "$CONTENT_WIDTH"
|
center "Installing Omarchy" "$CONTENT_WIDTH"
|
||||||
blank_line
|
blank_line
|
||||||
line_at "$CONTENT_WIDTH" $(( (CONTENT_WIDTH - 40) / 2 )) ""
|
line_at "$CONTENT_WIDTH" $(( (CONTENT_WIDTH - 34) / 2 )) ""
|
||||||
progress_bar "$pct" 34
|
progress_bar "$pct" 34
|
||||||
printf '\n'
|
printf '\n'
|
||||||
blank_line
|
blank_line
|
||||||
center "${GREEN}${spin[$((frame % 4))]} $(current_whimsy "$frame" "$pct") ${RESET}" "$CONTENT_WIDTH"
|
center "${GREEN}$(current_whimsy "$frame" "$pct")${RESET}" "$CONTENT_WIDTH"
|
||||||
blank_line
|
|
||||||
center "${DIM}Logs are being saved for support${RESET}" "$CONTENT_WIDTH"
|
|
||||||
printf '%s' "$CLEAR_TO_END"
|
printf '%s' "$CLEAR_TO_END"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,24 +303,32 @@ PY
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_finish() {
|
render_finish() {
|
||||||
local duration message cols
|
local duration effect_canvas_width
|
||||||
cols="$(term_cols)"
|
|
||||||
duration="$(install_duration || true)"
|
duration="$(install_duration || true)"
|
||||||
message="Finished installing"
|
duration="${duration:-Complete}"
|
||||||
[[ -n $duration ]] && message="Installed in $duration"
|
effect_canvas_width="$(term_cols)"
|
||||||
|
(( effect_canvas_width > 1 )) && effect_canvas_width=$((effect_canvas_width - 1))
|
||||||
|
|
||||||
{
|
{
|
||||||
printf '%s%s' "$SHOW_CURSOR" "$CLEAR"
|
printf '%s%s' "$SHOW_CURSOR" "$CLEAR"
|
||||||
|
blank_line
|
||||||
render_logo
|
render_logo
|
||||||
blank_line
|
blank_line
|
||||||
center "$message" "$cols"
|
center "Installed Omarchy" "$CONTENT_WIDTH"
|
||||||
blank_line
|
blank_line
|
||||||
|
line_at "$CONTENT_WIDTH" $(( (CONTENT_WIDTH - 34) / 2 )) ""
|
||||||
|
progress_bar 100 34
|
||||||
|
printf '\n'
|
||||||
|
blank_line
|
||||||
|
center "${GREEN}${duration}${RESET}" "$CONTENT_WIDTH"
|
||||||
} >"$TTY_PATH"
|
} >"$TTY_PATH"
|
||||||
|
|
||||||
if command -v tte >/dev/null 2>&1 && command -v timeout >/dev/null 2>&1 && [[ -f $LOGO_PATH ]]; then
|
if command -v tte >/dev/null 2>&1 && command -v timeout >/dev/null 2>&1 && [[ -f $LOGO_PATH ]]; then
|
||||||
printf '%s%d;1H' "$CSI" "$((LOGO_HEIGHT + 1))" >"$TTY_PATH"
|
# TTE reuse mode restores a saved cursor before moving up over its input.
|
||||||
|
# Save this anchor so the effect redraws the same logo rows shown above.
|
||||||
|
printf '%s%d;1H\0337' "$CSI" "$((LOGO_HEIGHT + 2))" >"$TTY_PATH"
|
||||||
timeout 8s tte -i "$LOGO_PATH" \
|
timeout 8s tte -i "$LOGO_PATH" \
|
||||||
--canvas-width 0 \
|
--canvas-width "$effect_canvas_width" \
|
||||||
--anchor-text c \
|
--anchor-text c \
|
||||||
--frame-rate 60 \
|
--frame-rate 60 \
|
||||||
--reuse-canvas \
|
--reuse-canvas \
|
||||||
@@ -334,7 +339,7 @@ render_finish() {
|
|||||||
--final-gradient-stops 9ece6a \
|
--final-gradient-stops 9ece6a \
|
||||||
--final-gradient-steps 1 \
|
--final-gradient-steps 1 \
|
||||||
>"$TTY_PATH" 2>/dev/null || true
|
>"$TTY_PATH" 2>/dev/null || true
|
||||||
printf '%s%d;1H' "$CSI" "$((LOGO_HEIGHT + 5))" >"$TTY_PATH"
|
printf '%s%d;1H' "$CSI" "$((LOGO_HEIGHT + 8))" >"$TTY_PATH"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user