forked from kwankiu/archlinux-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest1
More file actions
68 lines (59 loc) · 1.5 KB
/
test1
File metadata and controls
68 lines (59 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
IMG_PATH="test2.png"
# Função para centralizar uma linha
center_text() {
local text="$1"
local width=$(tput cols)
local pad=$(( (width - ${#text}) / 2 ))
printf "%*s%s\n" "$pad" "" "$text"
}
# Função para desenhar o menu com imagem
draw_menu() {
clear
local term_height=$(tput lines)
local term_width=$(tput cols)
local img_height=20
# Mostra imagem (como "título")
chafa --symbols=block,braille,ascii --fill=block --size=${term_width}x${img_height} "$IMG_PATH"
# Número de linhas do menu
local menu_lines=7
# Calcula espaço vertical para centralizar
local top_margin=$(( (term_height - img_height - menu_lines) / 2 ))
for ((i = 0; i < top_margin; i++)); do
echo ""
done
center_text "=========== MENU ==========="
center_text "1) Início"
center_text "2) Ver informações"
center_text "3) Sair"
center_text "============================"
echo
center_text "Escolha uma opção: "
}
# Loop principal
while true; do
draw_menu
read -r choice
case $choice in
1)
clear
center_text "Você escolheu: Início"
read -n 1 -s -r -p "$(center_text 'Pressione qualquer tecla para continuar...')"
;;
2)
clear
center_text "Informações do sistema:"
center_text "$(uname -a)"
echo
read -n 1 -s -r -p "$(center_text 'Pressione qualquer tecla para continuar...')"
;;
3)
center_text "Saindo..."
break
;;
*)
center_text "Opção inválida."
sleep 1
;;
esac
done