Keep the installer centered when console geometry shifts
Remeasure the terminal at every screen redraw instead of once at boot: the framebuffer can settle after the configurator starts (VM windows especially), which left stale padding for the whole flow. Pad the confirm-screen warnings with say so every line shares the same left edge. Boot the test VM with SDL instead of GTK, whose GL display path crops the guest framebuffer on HiDPI Wayland desktops. Verified in a live VM by driving the whole flow over QMP and reading each screen back from /dev/vcs1: all screens center on the real console width. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
969d461eb9
commit
434db24b81
2 files changed
+27
-19
No files matched your search
@@ -161,7 +161,7 @@ qemu-system-x86_64 \
|
||||
-drive file="$ISO",media=cdrom,if=none,format=raw,id=cdrom0 \
|
||||
-device ide-cd,drive=cdrom0,bootindex=2 \
|
||||
-device virtio-vga-gl \
|
||||
-display gtk,gl=on \
|
||||
-display sdl,gl=on \
|
||||
-usb -device usb-tablet \
|
||||
"${NET_ARGS[@]}" \
|
||||
-boot menu=on \
|
||||
|
||||
@@ -9,29 +9,37 @@ OMARCHY_SETTINGS_PACKAGE="${OMARCHY_SETTINGS_PACKAGE:-omarchy-settings}"
|
||||
|
||||
LOGO_PATH="$OMARCHY_PATH/logo.txt"
|
||||
|
||||
# gum draws on /dev/tty, so measure that rather than trusting inherited COLUMNS
|
||||
TERM_WIDTH=$(stty size 2>/dev/null </dev/tty | awk '{print $2}')
|
||||
(( TERM_WIDTH > 0 )) || TERM_WIDTH=${COLUMNS:-80}
|
||||
|
||||
LOGO_WIDTH=$(awk '{ if (length > max) max = length } END { print max+0 }' "$LOGO_PATH")
|
||||
PADDING_LEFT=$(((TERM_WIDTH - LOGO_WIDTH) / 2))
|
||||
(( PADDING_LEFT < 0 )) && PADDING_LEFT=0
|
||||
PADDING_LEFT_SPACES=$(printf "%*s" "$PADDING_LEFT" "")
|
||||
PADDING="0 0 0 $PADDING_LEFT"
|
||||
|
||||
export GUM_CONFIRM_PROMPT_FOREGROUND="6"
|
||||
export GUM_CONFIRM_SELECTED_FOREGROUND="0"
|
||||
export GUM_CONFIRM_SELECTED_BACKGROUND="2"
|
||||
export GUM_CONFIRM_UNSELECTED_FOREGROUND="7"
|
||||
export GUM_CONFIRM_UNSELECTED_BACKGROUND="0"
|
||||
export GUM_CHOOSE_PADDING="$PADDING"
|
||||
export GUM_FILTER_PADDING="$PADDING"
|
||||
export GUM_INPUT_PADDING="$PADDING"
|
||||
export GUM_SPIN_PADDING="$PADDING"
|
||||
export GUM_TABLE_PADDING="$PADDING"
|
||||
export GUM_CONFIRM_PADDING="$PADDING"
|
||||
|
||||
# The console can grow after boot (the framebuffer settles late, especially in
|
||||
# VMs), so remeasure at every redraw rather than trusting startup geometry.
|
||||
# gum draws on /dev/tty, so measure that rather than inherited COLUMNS.
|
||||
measure_terminal() {
|
||||
TERM_WIDTH=$(stty size 2>/dev/null </dev/tty | awk '{print $2}')
|
||||
(( TERM_WIDTH > 0 )) || TERM_WIDTH=${COLUMNS:-80}
|
||||
|
||||
PADDING_LEFT=$(((TERM_WIDTH - LOGO_WIDTH) / 2))
|
||||
(( PADDING_LEFT < 0 )) && PADDING_LEFT=0
|
||||
PADDING_LEFT_SPACES=$(printf "%*s" "$PADDING_LEFT" "")
|
||||
|
||||
PADDING="0 0 0 $PADDING_LEFT"
|
||||
export GUM_CHOOSE_PADDING="$PADDING"
|
||||
export GUM_FILTER_PADDING="$PADDING"
|
||||
export GUM_INPUT_PADDING="$PADDING"
|
||||
export GUM_SPIN_PADDING="$PADDING"
|
||||
export GUM_TABLE_PADDING="$PADDING"
|
||||
export GUM_CONFIRM_PADDING="$PADDING"
|
||||
}
|
||||
measure_terminal
|
||||
|
||||
clear_logo() {
|
||||
measure_terminal
|
||||
printf "\033[H\033[2J"
|
||||
gum style --foreground 2 --padding "1 0 0 $PADDING_LEFT" "$(<"$LOGO_PATH")"
|
||||
}
|
||||
@@ -505,11 +513,11 @@ run_partition_install() {
|
||||
while true; do
|
||||
clear_logo
|
||||
echo
|
||||
gum style "Install Omarchy in the $(to_gb $INSTALL_MAX_B) of free space."
|
||||
say "Install Omarchy in the $(to_gb $INSTALL_MAX_B) of free space."
|
||||
|
||||
case $mode in
|
||||
encrypted)
|
||||
gum style --foreground 8 "Press Ctrl+C for unencrypted install."
|
||||
say --foreground 8 "Press Ctrl+C for unencrypted install."
|
||||
affirmative="Yes, install"
|
||||
;;
|
||||
unencrypted)
|
||||
@@ -803,10 +811,10 @@ confirm_disk_overwrite() {
|
||||
while true; do
|
||||
clear_logo
|
||||
echo
|
||||
gum style "Everything will be overwritten. There is no recovery possible."
|
||||
say "Everything will be overwritten. There is no recovery possible."
|
||||
|
||||
if [[ $mode == "encrypted" ]]; then
|
||||
gum style --foreground 8 "Press Ctrl+C for unencrypted install."
|
||||
say --foreground 8 "Press Ctrl+C for unencrypted install."
|
||||
affirmative="Yes, install"
|
||||
else
|
||||
affirmative="Yes, install without encryption"
|
||||
|
||||
Reference in new issue
Block a user