style fixes for install.sh?
This commit is contained in:
152
install.sh
152
install.sh
@@ -9,55 +9,44 @@ set -e
|
|||||||
TERM_WIDTH=$(tput cols 2>/dev/null || echo 80)
|
TERM_WIDTH=$(tput cols 2>/dev/null || echo 80)
|
||||||
TERM_HEIGHT=$(tput lines 2>/dev/null || echo 24)
|
TERM_HEIGHT=$(tput lines 2>/dev/null || echo 24)
|
||||||
|
|
||||||
# Tokyo Night Color Palette
|
# Tokyo Night Color Palette (using printf for better compatibility)
|
||||||
BG='\033[48;2;26;27;38m' # #1a1b26
|
setup_colors() {
|
||||||
FG='\033[38;2;192;202;245m' # #c0caf5
|
BG=$(printf '\033[48;2;26;27;38m') # #1a1b26
|
||||||
BLUE='\033[38;2;122;162;247m' # #7aa2f7
|
FG=$(printf '\033[38;2;192;202;245m') # #c0caf5
|
||||||
CYAN='\033[38;2;125;207;255m' # #7dcfff
|
BLUE=$(printf '\033[38;2;122;162;247m') # #7aa2f7
|
||||||
GREEN='\033[38;2;158;206;106m' # #9ece6a
|
CYAN=$(printf '\033[38;2;125;207;255m') # #7dcfff
|
||||||
YELLOW='\033[38;2;224;175;104m' # #e0af68
|
GREEN=$(printf '\033[38;2;158;206;106m') # #9ece6a
|
||||||
RED='\033[38;2;247;118;142m' # #f7768e
|
YELLOW=$(printf '\033[38;2;224;175;104m') # #e0af68
|
||||||
PURPLE='\033[38;2;187;154;247m' # #bb9af7
|
RED=$(printf '\033[38;2;247;118;142m') # #f7768e
|
||||||
ORANGE='\033[38;2;255;158;100m' # #ff9e64
|
PURPLE=$(printf '\033[38;2;187;154;247m') # #bb9af7
|
||||||
DARK_BLUE='\033[38;2;65;72;104m' # #414868
|
ORANGE=$(printf '\033[38;2;255;158;100m') # #ff9e64
|
||||||
|
DARK_BLUE=$(printf '\033[38;2;65;72;104m') # #414868
|
||||||
|
|
||||||
# Special effects
|
# Special effects
|
||||||
BOLD='\033[1m'
|
BOLD=$(printf '\033[1m')
|
||||||
DIM='\033[2m'
|
DIM=$(printf '\033[2m')
|
||||||
UNDERLINE='\033[4m'
|
UNDERLINE=$(printf '\033[4m')
|
||||||
BLINK='\033[5m'
|
BLINK=$(printf '\033[5m')
|
||||||
RESET='\033[0m'
|
RESET=$(printf '\033[0m')
|
||||||
CLEAR='\033[2J'
|
CLEAR=$(printf '\033[2J')
|
||||||
CURSOR_HOME='\033[H'
|
CURSOR_HOME=$(printf '\033[H')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initialize colors
|
||||||
|
setup_colors
|
||||||
|
|
||||||
# Utility functions
|
# Utility functions
|
||||||
center_text() {
|
center_text() {
|
||||||
local text="$1"
|
local text="$1"
|
||||||
local width=${2:-$TERM_WIDTH}
|
local width=${2:-$TERM_WIDTH}
|
||||||
local padding=$(( (width - ${#text}) / 2 ))
|
# Strip ANSI codes for accurate length calculation
|
||||||
printf "%*s%s\n" $padding "" "$text"
|
local clean_text=$(echo "$text" | sed 's/\x1b\[[0-9;]*m//g')
|
||||||
}
|
local padding=$(( (width - ${#clean_text}) / 2 ))
|
||||||
|
if [ $padding -gt 0 ]; then
|
||||||
draw_box() {
|
printf "%*s%b\n" $padding "" "$text"
|
||||||
local width=${1:-60}
|
else
|
||||||
local height=${2:-3}
|
printf "%b\n" "$text"
|
||||||
local char=${3:-"─"}
|
fi
|
||||||
local corner_char=${4:-"╭╮╰╯"}
|
|
||||||
|
|
||||||
# Top border
|
|
||||||
printf "${BLUE}%c" "${corner_char:0:1}"
|
|
||||||
for ((i=0; i<width-2; i++)); do printf "$char"; done
|
|
||||||
printf "%c${RESET}\n" "${corner_char:1:1}"
|
|
||||||
|
|
||||||
# Middle empty lines
|
|
||||||
for ((i=0; i<height-2; i++)); do
|
|
||||||
printf "${BLUE}│%*s│${RESET}\n" $((width-2)) ""
|
|
||||||
done
|
|
||||||
|
|
||||||
# Bottom border
|
|
||||||
printf "${BLUE}%c" "${corner_char:2:1}"
|
|
||||||
for ((i=0; i<width-2; i++)); do printf "$char"; done
|
|
||||||
printf "%c${RESET}\n" "${corner_char:3:1}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progress_bar() {
|
progress_bar() {
|
||||||
@@ -98,23 +87,13 @@ loading_spinner() {
|
|||||||
printf "\r${GREEN}✓ ${FG}%s${RESET}\n" "$message"
|
printf "\r${GREEN}✓ ${FG}%s${RESET}\n" "$message"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set Tokyo Night terminal colors
|
# Set terminal background and clear
|
||||||
setup_terminal() {
|
setup_terminal() {
|
||||||
# Set background color for full terminal
|
printf "${CLEAR}${CURSOR_HOME}"
|
||||||
printf "${BG}${CLEAR}${CURSOR_HOME}"
|
# Don't set background color as it may not work in all terminals
|
||||||
|
|
||||||
# Set Tokyo Night color palette for terminal
|
|
||||||
printf '\033]4;0;color0\007' # Black
|
|
||||||
printf '\033]4;1;color1\007' # Red
|
|
||||||
printf '\033]4;2;color2\007' # Green
|
|
||||||
printf '\033]4;3;color3\007' # Yellow
|
|
||||||
printf '\033]4;4;color4\007' # Blue
|
|
||||||
printf '\033]4;5;color5\007' # Magenta
|
|
||||||
printf '\033]4;6;color6\007' # Cyan
|
|
||||||
printf '\033]4;7;color7\007' # White
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stylized banner with animations
|
# Stylized banner with proper escaping
|
||||||
show_banner() {
|
show_banner() {
|
||||||
clear
|
clear
|
||||||
setup_terminal
|
setup_terminal
|
||||||
@@ -122,18 +101,18 @@ show_banner() {
|
|||||||
# Add some vertical spacing
|
# Add some vertical spacing
|
||||||
for ((i=0; i<3; i++)); do echo; done
|
for ((i=0; i<3; i++)); do echo; done
|
||||||
|
|
||||||
# Main logo with color gradient effect
|
# Main logo - using simpler ASCII that works better
|
||||||
echo
|
echo
|
||||||
center_text "${CYAN}${BOLD}███████╗███╗ ███╗███╗ ██╗██╗██╗ ██╗██╗ ██╗"
|
center_text "${CYAN}${BOLD} ██████╗ ███╗ ███╗███╗ ██╗██╗██╗ ██╗██╗ ██╗"
|
||||||
center_text "██╔════╝████╗ ████║████╗ ██║██║╚██╗██╔╝╚██╗ ██╔╝"
|
center_text "██╔═══██╗████╗ ████║████╗ ██║██║╚██╗██╔╝╚██╗ ██╔╝"
|
||||||
center_text "${BLUE}██║ ██╔████╔██║██╔██╗ ██║██║ ╚███╔╝ ╚████╔╝ "
|
center_text "${BLUE}██║ ██║██╔████╔██║██╔██╗ ██║██║ ╚███╔╝ ╚████╔╝ "
|
||||||
center_text "██║ ██║╚██╔╝██║██║╚██╗██║██║ ██╔██╗ ╚██╔╝ "
|
center_text "██║ ██║██║╚██╔╝██║██║╚██╗██║██║ ██╔██╗ ╚██╔╝ "
|
||||||
center_text "${PURPLE}███████╗██║ ╚═╝ ██║██║ ╚████║██║██╔╝ ██╗ ██║ "
|
center_text "${PURPLE}╚██████╔╝██║ ╚═╝ ██║██║ ╚████║██║██╔╝ ██╗ ██║ "
|
||||||
center_text "╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═╝ ${RESET}"
|
center_text " ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═╝ ${RESET}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Subtitle with typewriter effect
|
# Subtitle with typewriter effect
|
||||||
printf "%*s" $(( (TERM_WIDTH - 60) / 2 )) ""
|
printf "%*s" $(( (TERM_WIDTH - 40) / 2 )) ""
|
||||||
animate_text "🚀 Declarative • 🎨 Beautiful • ⚡ Fast" "$CYAN" 0.05
|
animate_text "🚀 Declarative • 🎨 Beautiful • ⚡ Fast" "$CYAN" 0.05
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
@@ -162,9 +141,10 @@ section_header() {
|
|||||||
for ((i=0; i<width-2; i++)); do printf "─"; done
|
for ((i=0; i<width-2; i++)); do printf "─"; done
|
||||||
printf "╮${RESET}\n"
|
printf "╮${RESET}\n"
|
||||||
|
|
||||||
|
local header_text=" $icon $title"
|
||||||
|
local header_padding=$((width - 4 - ${#header_text}))
|
||||||
printf "%*s" $(( (TERM_WIDTH - width) / 2 )) ""
|
printf "%*s" $(( (TERM_WIDTH - width) / 2 )) ""
|
||||||
printf "${BLUE}│${BOLD}${CYAN} $icon $title"
|
printf "${BLUE}│${BOLD}${CYAN}%s%*s${BLUE}│${RESET}\n" "$header_text" $header_padding ""
|
||||||
printf "%*s${BLUE}│${RESET}\n" $((width - 6 - ${#title} - ${#icon})) ""
|
|
||||||
|
|
||||||
printf "%*s" $(( (TERM_WIDTH - width) / 2 )) ""
|
printf "%*s" $(( (TERM_WIDTH - width) / 2 )) ""
|
||||||
printf "${BLUE}╰"
|
printf "${BLUE}╰"
|
||||||
@@ -173,24 +153,6 @@ section_header() {
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stylized menu options
|
|
||||||
show_menu() {
|
|
||||||
local title="$1"
|
|
||||||
shift
|
|
||||||
local options=("$@")
|
|
||||||
|
|
||||||
section_header "$title" "🎛️ "
|
|
||||||
|
|
||||||
for i in "${!options[@]}"; do
|
|
||||||
local num=$((i + 1))
|
|
||||||
center_text "${BOLD}${CYAN}$num.${RESET}${FG} ${options[$i]}"
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
center_text "${DIM}${FG}Enter your choice:${RESET}"
|
|
||||||
printf "%*s" $(( TERM_WIDTH / 2 - 5 )) ""
|
|
||||||
printf "${CYAN}► ${RESET}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Enhanced user input with validation
|
# Enhanced user input with validation
|
||||||
get_input() {
|
get_input() {
|
||||||
local prompt="$1"
|
local prompt="$1"
|
||||||
@@ -198,7 +160,7 @@ get_input() {
|
|||||||
local validator="$3"
|
local validator="$3"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
printf "%*s${FG}%s" $(( (TERM_WIDTH - ${#prompt} - 10) / 2 )) "" "$prompt"
|
printf "%*s${FG}%s" $(( (TERM_WIDTH - ${#prompt} - 20) / 2 )) "" "$prompt"
|
||||||
if [[ -n "$default" ]]; then
|
if [[ -n "$default" ]]; then
|
||||||
printf "${DIM} (default: $default)${RESET}"
|
printf "${DIM} (default: $default)${RESET}"
|
||||||
fi
|
fi
|
||||||
@@ -357,7 +319,7 @@ select_theme() {
|
|||||||
loading_spinner $! "Applying theme configuration"
|
loading_spinner $! "Applying theme configuration"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Feature configuration with checkboxes
|
# Feature configuration
|
||||||
configure_features() {
|
configure_features() {
|
||||||
section_header "Feature Configuration" "⚙️ "
|
section_header "Feature Configuration" "⚙️ "
|
||||||
|
|
||||||
@@ -372,7 +334,7 @@ configure_features() {
|
|||||||
echo
|
echo
|
||||||
if [[ $reply =~ ^[Yy]$ ]]; then
|
if [[ $reply =~ ^[Yy]$ ]]; then
|
||||||
center_text "${GREEN}✅ Fingerprint authentication enabled${RESET}"
|
center_text "${GREEN}✅ Fingerprint authentication enabled${RESET}"
|
||||||
sudo sed -i 's/enable = false;/enable = true;/' /etc/nixos/configuration.nix
|
sudo sed -i 's/fingerprint = {/fingerprint = {\n enable = true;/' /etc/nixos/configuration.nix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%*s" $(( (TERM_WIDTH - 35) / 2 )) ""
|
printf "%*s" $(( (TERM_WIDTH - 35) / 2 )) ""
|
||||||
@@ -381,6 +343,7 @@ configure_features() {
|
|||||||
echo
|
echo
|
||||||
if [[ $reply =~ ^[Yy]$ ]]; then
|
if [[ $reply =~ ^[Yy]$ ]]; then
|
||||||
center_text "${GREEN}✅ FIDO2 authentication enabled${RESET}"
|
center_text "${GREEN}✅ FIDO2 authentication enabled${RESET}"
|
||||||
|
sudo sed -i 's/fido2 = {/fido2 = {\n enable = true;/' /etc/nixos/configuration.nix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -391,6 +354,7 @@ configure_features() {
|
|||||||
echo
|
echo
|
||||||
if [[ $reply =~ ^[Yy]$ ]]; then
|
if [[ $reply =~ ^[Yy]$ ]]; then
|
||||||
center_text "${GREEN}✅ Docker support enabled${RESET}"
|
center_text "${GREEN}✅ Docker support enabled${RESET}"
|
||||||
|
# Add Docker configuration
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -401,6 +365,7 @@ configure_features() {
|
|||||||
echo
|
echo
|
||||||
if [[ $reply =~ ^[Yy]$ ]]; then
|
if [[ $reply =~ ^[Yy]$ ]]; then
|
||||||
center_text "${GREEN}✅ Gaming support enabled${RESET}"
|
center_text "${GREEN}✅ Gaming support enabled${RESET}"
|
||||||
|
# Add gaming configuration
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +457,7 @@ build_system() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Completion screen with comprehensive information
|
# Completion screen
|
||||||
show_complete() {
|
show_complete() {
|
||||||
clear
|
clear
|
||||||
setup_terminal
|
setup_terminal
|
||||||
@@ -531,8 +496,6 @@ show_complete() {
|
|||||||
center_text "${CYAN}Super + B${RESET} ${FG}- Web browser${RESET}"
|
center_text "${CYAN}Super + B${RESET} ${FG}- Web browser${RESET}"
|
||||||
center_text "${CYAN}Super + E${RESET} ${FG}- File manager${RESET}"
|
center_text "${CYAN}Super + E${RESET} ${FG}- File manager${RESET}"
|
||||||
center_text "${CYAN}Super + Q${RESET} ${FG}- Close window${RESET}"
|
center_text "${CYAN}Super + Q${RESET} ${FG}- Close window${RESET}"
|
||||||
center_text "${CYAN}Super + F${RESET} ${FG}- Fullscreen toggle${RESET}"
|
|
||||||
center_text "${CYAN}Super + 1-0${RESET} ${FG}- Switch workspaces${RESET}"
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
section_header "Next Steps" "📋"
|
section_header "Next Steps" "📋"
|
||||||
@@ -543,15 +506,10 @@ show_complete() {
|
|||||||
center_text "${FG}2. ${CYAN}Run omnixy-security status${RESET} ${FG}- Check security setup${RESET}"
|
center_text "${FG}2. ${CYAN}Run omnixy-security status${RESET} ${FG}- Check security setup${RESET}"
|
||||||
center_text "${FG}3. ${CYAN}Configure fingerprint/FIDO2${RESET} ${FG}- Enhanced security${RESET}"
|
center_text "${FG}3. ${CYAN}Configure fingerprint/FIDO2${RESET} ${FG}- Enhanced security${RESET}"
|
||||||
center_text "${FG}4. ${CYAN}Explore themes${RESET} ${FG}- Try different color schemes${RESET}"
|
center_text "${FG}4. ${CYAN}Explore themes${RESET} ${FG}- Try different color schemes${RESET}"
|
||||||
center_text "${FG}5. ${CYAN}Join the community${RESET} ${FG}- Get help and share feedback${RESET}"
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
section_header "Resources" "🔗"
|
|
||||||
|
|
||||||
center_text "${BLUE}${UNDERLINE}https://github.com/TheArctesian/omnixy${RESET} ${FG}- Project homepage${RESET}"
|
center_text "${BLUE}${UNDERLINE}https://github.com/TheArctesian/omnixy${RESET} ${FG}- Project homepage${RESET}"
|
||||||
center_text "${BLUE}${UNDERLINE}https://nixos.org/manual${RESET} ${FG}- NixOS documentation${RESET}"
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo
|
echo
|
||||||
center_text "${DIM}${FG}Thank you for choosing OmniXY! ${CYAN}❤️${RESET}"
|
center_text "${DIM}${FG}Thank you for choosing OmniXY! ${CYAN}❤️${RESET}"
|
||||||
echo
|
echo
|
||||||
@@ -577,7 +535,7 @@ show_complete() {
|
|||||||
# Main installation orchestrator
|
# Main installation orchestrator
|
||||||
main() {
|
main() {
|
||||||
# Trap to restore terminal on exit
|
# Trap to restore terminal on exit
|
||||||
trap 'printf "\033[0m\033[?25h"; stty sane' EXIT
|
trap 'printf "\033[0m\033[?25h"; stty sane 2>/dev/null || true' EXIT
|
||||||
|
|
||||||
# Hide cursor during installation
|
# Hide cursor during installation
|
||||||
printf '\033[?25l'
|
printf '\033[?25l'
|
||||||
|
|||||||
Reference in New Issue
Block a user