mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
q 0.66
This commit is contained in:
parent
2e0c930095
commit
fa40efa6dc
1 changed files with 819 additions and 92 deletions
911
q
911
q
|
@ -1,13 +1,15 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
# Author: zenobit
|
# Author: zenobit
|
||||||
# Description: Uses gum to provide a simple VMs runner for quickemu and quickget
|
# Description: Uses gum to provide a simple TUI for quickemu and quickget
|
||||||
# License MIT
|
# License MIT
|
||||||
|
|
||||||
_define_variables() {
|
## NEEDED
|
||||||
|
|
||||||
|
define_variables() {
|
||||||
color=$(( RANDOM % 255 + 1 ))
|
color=$(( RANDOM % 255 + 1 ))
|
||||||
progname="${progname:="${0##*/}"}"
|
progname="${progname:="${0##*/}"}"
|
||||||
#configdir="$HOME/.config/$progname"
|
configdir="$HOME/.config/$progname"
|
||||||
version='0.2'
|
version='0.66'
|
||||||
vms=(*.conf)
|
vms=(*.conf)
|
||||||
if ! command -v gum >/dev/null 2>&1; then
|
if ! command -v gum >/dev/null 2>&1; then
|
||||||
echo 'You are missing gum! Exiting...' && exit 1
|
echo 'You are missing gum! Exiting...' && exit 1
|
||||||
|
@ -17,6 +19,7 @@ _define_variables() {
|
||||||
fi
|
fi
|
||||||
QUICKGET=$(command -v quickget)
|
QUICKGET=$(command -v quickget)
|
||||||
#export BORDER="rounded"
|
#export BORDER="rounded"
|
||||||
|
color2=$(( RANDOM % 255 + 1 ))
|
||||||
export BORDERS_FOREGROUND="$color"
|
export BORDERS_FOREGROUND="$color"
|
||||||
export GUM_CHOOSE_CURSOR_FOREGROUND="$color"
|
export GUM_CHOOSE_CURSOR_FOREGROUND="$color"
|
||||||
export GUM_CHOOSE_SELECTED_FOREGROUND="$color"
|
export GUM_CHOOSE_SELECTED_FOREGROUND="$color"
|
||||||
|
@ -25,90 +28,112 @@ _define_variables() {
|
||||||
export GUM_CONFIRM_UNSELECTED_FOREGROUND=0
|
export GUM_CONFIRM_UNSELECTED_FOREGROUND=0
|
||||||
export GUM_FILTER_CURSOR_TEXT_FOREGROUND=""
|
export GUM_FILTER_CURSOR_TEXT_FOREGROUND=""
|
||||||
export GUM_FILTER_HEADER_FOREGROUND=""
|
export GUM_FILTER_HEADER_FOREGROUND=""
|
||||||
export GUM_FILTER_INDICATOR_FOREGROUND="$color"
|
export GUM_FILTER_INDICATOR_FOREGROUND="$color2"
|
||||||
export GUM_FILTER_MATCH_FOREGROUND="$color"
|
export GUM_FILTER_MATCH_FOREGROUND="$color2"
|
||||||
export GUM_FILTER_PROMPT_FOREGROUND="$color"
|
export GUM_FILTER_PROMPT_FOREGROUND="$color2"
|
||||||
export GUM_FILTER_SELECTED_PREFIX_FOREGROUND="$color"
|
export GUM_FILTER_SELECTED_PREFIX_FOREGROUND="$color2"
|
||||||
export GUM_FILTER_SELECTED_PREFIX_BORDER_FOREGROUND="$color"
|
export GUM_FILTER_SELECTED_PREFIX_BORDER_FOREGROUND="$color2"
|
||||||
|
|
||||||
|
# Set traps to catch the signals and exit gracefully
|
||||||
|
trap 'exit' INT
|
||||||
|
trap 'exit' EXIT
|
||||||
|
if ! command -v quickemu >/dev/null 2>&1; then
|
||||||
|
echo 'You are missing quickemu...!'
|
||||||
|
fi
|
||||||
|
QUICKGET=$(command -v quickget)
|
||||||
|
if ! command -v gum >/dev/null 2>&1; then
|
||||||
|
echo 'You are missing gum...!'
|
||||||
|
fi
|
||||||
|
# just for development in termux
|
||||||
|
if command -v termux-info >/dev/null 2>&1; then
|
||||||
|
echo "Running in termux!"
|
||||||
|
TMP="$(pwd)/tmp"
|
||||||
|
fi
|
||||||
|
# use configdir
|
||||||
|
if [ -f "${configdir}/border" ]; then
|
||||||
|
BORDER="$(cat "${configdir}"/border)"
|
||||||
|
else
|
||||||
|
BORDER="double"
|
||||||
|
fi
|
||||||
|
if [ -f "${configdir}/color" ]; then
|
||||||
|
BORDERS_FOREGROUND="$(cat "${configdir}"/color)"
|
||||||
|
else
|
||||||
|
BORDERS_FOREGROUND="$(( RANDOM % 255 + 1 ))"
|
||||||
|
fi
|
||||||
|
if [ -f "${configdir}/spinner" ]; then
|
||||||
|
spinner="$(cat "${configdir}"/spinner)"
|
||||||
|
else
|
||||||
|
spinner="globe"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_generate_supported(){
|
generate_supported(){
|
||||||
echo "Extracting OS Editions and Releases..."
|
echo "Extracting OS Editions and Releases..."
|
||||||
rm -rf /tmp/distros
|
rm -r "$configdir/distro"
|
||||||
mkdir -p /tmp/distros
|
mkdir -p "$configdir/distro"
|
||||||
"$QUICKGET" | awk 'NR==2,/zorin/' | cut -d':' -f2 | grep -o '[^ ]*' > /tmp/supported
|
"$QUICKGET" | awk 'NR==2,/zorin/' | cut -d':' -f2 | grep -o '[^ ]*' > "$configdir/supported"
|
||||||
while read -r get_name; do
|
while read -r get_name; do
|
||||||
supported=$($QUICKGET "$get_name" | sed 1d)
|
supported=$(gum spin --spinner $spinner --title="$get_name" -- "$QUICKGET" "$get_name" | sed 1d)
|
||||||
echo "$get_name"
|
echo "$get_name"
|
||||||
echo "$supported"
|
echo "$supported"
|
||||||
echo "$supported" > "/tmp/distros/${get_name}"
|
echo "$supported" > "$configdir/distro/${get_name}"
|
||||||
done < /tmp/supported
|
done < "$configdir/supported"
|
||||||
}
|
}
|
||||||
|
|
||||||
_if_needed() {
|
if_needed() {
|
||||||
if [ ! -f /tmp/supported ]; then
|
if [ ! -f "${configdir}"/supported ]; then
|
||||||
_generate_supported
|
generate_supported
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
color2=$(( RANDOM % 255 + 1 ))
|
## HELP
|
||||||
|
|
||||||
show_headers() {
|
show_help() {
|
||||||
if [ -f /tmp/icons ]; then
|
clear
|
||||||
icons=yes
|
show_headers_full
|
||||||
else
|
gum style --padding "0 1" --border="$BORDER" --border-foreground="$BORDERS_FOREGROUND" "$title"
|
||||||
icons=""
|
}
|
||||||
fi
|
|
||||||
logo_1=$(gum style --foreground "$color2" "▄▄▄▄
|
|
||||||
█ █
|
|
||||||
█ █
|
|
||||||
█▄▀▄")
|
|
||||||
logo_2=$(gum style "v$version")
|
|
||||||
logo_3=$(gum style --foreground "$color2" "▀")
|
|
||||||
logo_23=$(gum join "$logo_2" "$logo_3")
|
|
||||||
logo=$(gum join --vertical "$logo_1" "$logo_23")
|
|
||||||
logo_border=$(gum style --padding "0 1" --border=rounded --border-foreground $color "$logo" )
|
|
||||||
|
|
||||||
tip_header=$(gum style --bold "Tip: ")
|
help_main() {
|
||||||
distro=$(shuf -n 1 /tmp/supported)
|
title=" $progname $version
|
||||||
tip_distro=$(gum style --align="center" "try $distro")
|
Uses gum to provide a simple TUI for quickemu and quickget 'https://github.com/quickemu-project/quickemu'
|
||||||
tip_temp=$(gum join --align="center" "$tip_header" "$tip_distro")
|
'https://github.com/charmbracelet/gum'
|
||||||
homepage=$("$QUICKGET" -s "${distro}")
|
|
||||||
tip_homepage=$(gum style "$homepage")
|
|
||||||
tip=$(gum join --vertical --align top "$tip_temp" "$tip_homepage")
|
|
||||||
tip_border=$(gum style --padding "0 1" --border=rounded --border-foreground $color "$tip")
|
|
||||||
|
|
||||||
pid_files=(*/*.pid)
|
For menus you can use arrow keys or fuzzy filtering and then ENTER
|
||||||
vms=(*.conf)
|
(e + ENTER for exit or b + ENTER for back to main menu)
|
||||||
vms_running=()
|
|
||||||
vms_not=()
|
If is posible choose more options use TAB for highliting desired and then ENTER
|
||||||
vms_vm=$(gum style --align="center" --bold "ready:")
|
|
||||||
vms_run=""
|
Config files are stored at $configdir
|
||||||
if [ -n "$(find . -name '*.pid')" ]; then
|
|
||||||
for pid_file in "${pid_files[@]}"; do
|
As temp folder is used $TMP
|
||||||
instance_name=$(basename "$pid_file" .pid)
|
"
|
||||||
vms_running+=("$instance_name")
|
}
|
||||||
done
|
|
||||||
if [ "$icons" == yes ]; then
|
## MAIN
|
||||||
running_logo=$(gum style --foreground "$color" --bold ".")
|
|
||||||
else
|
#template for functions
|
||||||
running_logo=$(gum style --foreground "$color" --bold ">")
|
# title=""
|
||||||
fi
|
# show_header
|
||||||
for instance in "${vms_running[@]}"; do
|
|
||||||
vms_run+="$running_logo$instance "
|
gum_choose_os() {
|
||||||
done
|
title="Choose OS"
|
||||||
fi
|
show_header
|
||||||
mapfile -t vms_not < <(comm -23 <(printf "%s\n" "${vms[@]}" | rev | cut -d'.' -f2-9 | rev | sort) <(printf "%s\n" "${vms_running[@]}" | sort))
|
os=$(gum filter < "$configdir"/supported)
|
||||||
vms_not_next=$(gum style < <(printf '%s\n' "${vms_not[@]}"))
|
choices=$("$QUICKGET" "$os" | sed 1d)
|
||||||
if [ -n "$(find . -name '*.pid')" ]; then
|
}
|
||||||
vms_run_next=$(echo "$vms_run" | tr " " "\n")
|
|
||||||
vms_header=$(gum join --vertical "$vms_vm" "$vms_run_next" "$vms_not_next")
|
gum_choose_release() {
|
||||||
else
|
title="Choose release"
|
||||||
vms_header=$(gum join --vertical "$vms_vm" "$vms_not_next")
|
show_header
|
||||||
fi
|
height=$()
|
||||||
vms_border=$(gum style --padding "0 1" --border=rounded --border-foreground $color "$vms_header")
|
release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | gum filter --sort)
|
||||||
header=$(gum join --align top "$logo_border" "$vms_border")
|
}
|
||||||
gum join --align center --align top --vertical "$header" "$tip_border"
|
|
||||||
|
gum_choose_edition() {
|
||||||
|
title="Choose edition"
|
||||||
|
show_header
|
||||||
|
edition=$(echo "$choices" | grep 'Editions' | cut -d':' -f2 | grep -o '[^ ]*' | gum filter --prompt='Choose edition' --sort)
|
||||||
}
|
}
|
||||||
|
|
||||||
gum_filter_os() {
|
gum_filter_os() {
|
||||||
|
@ -132,6 +157,18 @@ gum_choose_VM() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gum_choose_VM() {
|
||||||
|
if ls | grep ".conf" ; then
|
||||||
|
height=$(ls -1 | grep ".conf" | wc -l)
|
||||||
|
title="Choose VM"
|
||||||
|
show_header
|
||||||
|
chosen=$(ls -1 | grep ".conf" | rev | cut -d'.' -f2- | rev | gum filter --height "$height")
|
||||||
|
else
|
||||||
|
echo "No VMs to run."
|
||||||
|
fi
|
||||||
|
#chosen=$(printf '%s\n' "${vms[@]%.conf}" | gum filter --height "$("${vms[@]%.conf}" | wc -l)" --header='Choose VM to run')
|
||||||
|
}
|
||||||
|
|
||||||
create_VM() {
|
create_VM() {
|
||||||
gum_filter_os
|
gum_filter_os
|
||||||
if [ -z "$os" ]; then exit 100
|
if [ -z "$os" ]; then exit 100
|
||||||
|
@ -151,8 +188,73 @@ create_VM() {
|
||||||
show_headers
|
show_headers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_VM() {
|
||||||
|
gum_choose_os
|
||||||
|
if [ -z "$os" ]; then exit 100
|
||||||
|
elif [ "$(echo "$choices" | wc -l)" = 1 ]; then
|
||||||
|
clear
|
||||||
|
gum_choose_release
|
||||||
|
#gum spin --spinner $spinner --show-output --title="Downloading $os $/release" -- "$QUICKGET" "$os" "$release"
|
||||||
|
"$QUICKGET" "$os" "$release"
|
||||||
|
if [ -f "${configdir}/default_vm_config" ]; then
|
||||||
|
echo 'Adding default values to config...'
|
||||||
|
cat "${configdir}/default_vm_config" >> "$os-$release.conf"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
clear
|
||||||
|
gum_choose_release
|
||||||
|
gum_choose_edition
|
||||||
|
gum spin --spinner $spinner --show-output --title="Downloading $os $release $edition" -- "$QUICKGET" "$os" "$release" "$edition"
|
||||||
|
if [ -f "${configdir}/default_vm_config" ]; then
|
||||||
|
echo 'Adding default values to config...'
|
||||||
|
cat "${configdir}/default_vm_config" >> "$os-$release-$edition.conf"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "
|
||||||
|
To start your new $os virtual machine use 'run' from menu"
|
||||||
|
show_headers_small
|
||||||
|
}
|
||||||
|
|
||||||
|
edit_default_VMs_config() {
|
||||||
|
title="Editing default VM's config..."
|
||||||
|
show_header
|
||||||
|
printf 'For example:\ncpu_cores="2"\nram="4G"\n'
|
||||||
|
title="CTRL+D to complete. CTRL+C and esc will cancel"
|
||||||
|
show_header
|
||||||
|
gum write > "${configdir}"/default_vm_config
|
||||||
|
}
|
||||||
|
|
||||||
|
edit_VM_config() {
|
||||||
|
if [ -z "$EDITOR" ]; then
|
||||||
|
echo "Editor not set! Can't continue!"
|
||||||
|
else
|
||||||
|
height=$(ls -1 | grep ".conf" | wc -l)
|
||||||
|
${EDITOR} "$(ls | grep ".conf" | gum filter --height "$height")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_quickemu_command() {
|
||||||
|
custom=$(echo "edit delete" | grep -o '[^ ]*' | gum choose --header='Edit or delete custom command?')
|
||||||
|
if [ "$custom" = "edit" ]; then
|
||||||
|
quickemu
|
||||||
|
printf '\nEnter quickemu custom command:\n For example:--public-dir ~/Downloads\n:'
|
||||||
|
read -r command
|
||||||
|
mkdir -p "$configdir"
|
||||||
|
echo "$command" > "${configdir}/command"
|
||||||
|
elif [ "$custom" = "delete" ]; then
|
||||||
|
rm "${configdir}/command"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
run_VM() {
|
run_VM() {
|
||||||
quickemu -vm "$chosen.conf"
|
title="Starting $chosen..."
|
||||||
|
show_header
|
||||||
|
if [ -f "${configdir}/command" ]; then
|
||||||
|
quickemu < "${configdir}/command" -vm "$chosen.conf"
|
||||||
|
else
|
||||||
|
quickemu -vm "$chosen.conf"
|
||||||
|
fi
|
||||||
show_headers
|
show_headers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +264,7 @@ gum_choose_running() {
|
||||||
mapfile -t running < <(find . -name '*.pid' -printf '%P\n' | sed 's/\.pid$//')
|
mapfile -t running < <(find . -name '*.pid' -printf '%P\n' | sed 's/\.pid$//')
|
||||||
|
|
||||||
if [ ${#running[@]} -gt 0 ]; then
|
if [ ${#running[@]} -gt 0 ]; then
|
||||||
selected=$(gum filter --select-if-one "${running[@]}")
|
selected=$(gum choose --select-if-one "${running[@]}")
|
||||||
else
|
else
|
||||||
gum style --foreground 1 "Can't!" && selected=""
|
gum style --foreground 1 "Can't!" && selected=""
|
||||||
fi
|
fi
|
||||||
|
@ -171,6 +273,201 @@ gum_choose_running() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# test
|
||||||
|
gum_choose_runnings() {
|
||||||
|
pid_files=( */*.pid )
|
||||||
|
if [ ${#pid_files[@]} -gt 0 ]; then
|
||||||
|
mapfile -t running < <(find . -name '*.pid' -printf '%P\n' | sed 's/\.pid$//')
|
||||||
|
|
||||||
|
if [ ${#running[@]} -gt 0 ]; then
|
||||||
|
selected=$(gum choose --select-if-one "${running[@]}")
|
||||||
|
else
|
||||||
|
gum style --foreground 1 "Can't!" && selected=""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
gum style --foreground 1 "Can't!" && selected=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
gum_choose_VM_to_delete() {
|
||||||
|
height=$(ls -1 | grep ".conf" | wc -l)
|
||||||
|
GUM_FILTER_HEADER="Choose VM to delete"
|
||||||
|
GUM_FILTER_HEADER_FOREGROUND=""
|
||||||
|
if ls | grep ".conf" ; then
|
||||||
|
chosen=$(echo ${vms[@]%.*} | tr " " "\n" | gum filter --height "$height" --no-limit)
|
||||||
|
echo 'Removing config(s)...'
|
||||||
|
rm -r $chosen & rm $chosen.conf
|
||||||
|
else
|
||||||
|
echo "No VMs to delete"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#gum_choose_VM_to_delete() {
|
||||||
|
#if ls | grep ".conf" ; then
|
||||||
|
#GUM_FILTER_HEADER="Choose VM to delete"
|
||||||
|
#height=$(ls -1 | grep ".conf" | wc -l)
|
||||||
|
#chosen=$(ls -1 | grep ".conf" | gum filter --height "$height" --no-limit)
|
||||||
|
#delete_VM
|
||||||
|
#else
|
||||||
|
#echo "No VMs to delete"
|
||||||
|
#fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
delete_VM() {
|
||||||
|
#chosen_to_delete=$(cat $chosen | while read line; echo $line | rev | cut -d'.' -f2-5 | rev; done)
|
||||||
|
echo "#TODO"
|
||||||
|
echo $chosen | tr " " "\n" | while read line
|
||||||
|
do
|
||||||
|
echo 'Removing dir(s)...'
|
||||||
|
rm -r $(echo $line | rev | cut -d'.' -f2-5 | rev)
|
||||||
|
done
|
||||||
|
echo 'Removing config(s)...'
|
||||||
|
rm $(echo "$chosen")
|
||||||
|
}
|
||||||
|
|
||||||
|
## ADVANCED
|
||||||
|
|
||||||
|
# shellcheck disable=SC2016,2034,2153
|
||||||
|
add_new_distro() {
|
||||||
|
mkdir -p "$configdir"
|
||||||
|
echo "add new OS, all lowercase"
|
||||||
|
NAME="$(gum input --header="NAME" --placeholder="arch")"
|
||||||
|
echo "add a pretty name for new OS *only if the catch all is not suitable*"
|
||||||
|
PRETTY_NAME="$(gum input --header="PRETTY_NAME" --placeholder="Arch Linux")"
|
||||||
|
echo "add a homepage for new OS"
|
||||||
|
HOMEPAGE="$(gum input --header="HOMEPAGE" --placeholder="https://voidlinux.org/")"
|
||||||
|
echo "current supported release versions"
|
||||||
|
RELEASES="$(gum input --header="RELEASES" --placeholder="8 9")"
|
||||||
|
echo "the editions if new OS has multiple flavours/editions"
|
||||||
|
EDITIONS="$(gum input --header="EDITIONS" --placeholder="kde gnome")"
|
||||||
|
echo "base URL for ISO download"
|
||||||
|
URL="$(gum input --header="URL" --placeholder="https://ddl.bunsenlabs.org/ddl")"
|
||||||
|
echo "Name of ISO"
|
||||||
|
ISO="$(gum input --header="ISO" --placeholder="GhostBSD-${RELEASE}-XFCE.iso")"
|
||||||
|
echo "name of hash file "
|
||||||
|
CHECKSUM="$(gum input --header="CHECKSUM" --placeholder='${ISO}.sha256sum')"
|
||||||
|
cat <<EOF > "$configdir/template"
|
||||||
|
#line 58+
|
||||||
|
|
||||||
|
$NAME) PRETTY_NAME="$PRETTY_NAME";;
|
||||||
|
|
||||||
|
#line 207+
|
||||||
|
|
||||||
|
$NAME \\
|
||||||
|
|
||||||
|
#line 292+
|
||||||
|
|
||||||
|
$NAME) HOMEPAGE=$HOMEPAGE;;
|
||||||
|
|
||||||
|
#line 374+
|
||||||
|
|
||||||
|
function releases_$NAME() {
|
||||||
|
echo $RELEASES
|
||||||
|
}
|
||||||
|
|
||||||
|
function editions_$NAME() {
|
||||||
|
echo $EDITIONS
|
||||||
|
}
|
||||||
|
|
||||||
|
#line 1176+
|
||||||
|
|
||||||
|
function get_$NAME() {
|
||||||
|
local EDITION="\${1:-}"
|
||||||
|
local HASH=""
|
||||||
|
local ISO="$ISO"
|
||||||
|
local URL="$URL"
|
||||||
|
HASH="\$(wget -q -O- \${URL}/\$CHECKSUM | grep (\${ISO} | cut -d' ' -f4)"
|
||||||
|
echo "\${URL}/\${ISO}" "\${HASH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
diff "$configdir/template" "quickget"
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
create_desktop_entry() {
|
||||||
|
cat <<EOF > "${DESKTOP_FILE}"
|
||||||
|
[Desktop Entry]
|
||||||
|
Version=$version
|
||||||
|
Type=$type
|
||||||
|
Name=$name
|
||||||
|
GenericName=$progname
|
||||||
|
Comment=$comment
|
||||||
|
Exec=$execmd
|
||||||
|
Icon=$icon
|
||||||
|
Terminal=$terminal
|
||||||
|
X-MultipleArgs=$args
|
||||||
|
Type=$type
|
||||||
|
Categories=$categories
|
||||||
|
StartupNotify=$notify
|
||||||
|
MimeType=$mime
|
||||||
|
Keywords=$keyword
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
test_ISOs_download() {
|
||||||
|
rm -r "$configdir"
|
||||||
|
mkdir -p "$configdir" && cd "$configdir" || exit
|
||||||
|
touch "$configdir/test"
|
||||||
|
#"$QUICKGET" | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > supported
|
||||||
|
os=$(gum filter < "$configdir"/supported)
|
||||||
|
choices=$("$QUICKGET" "$os" | sed 1d)
|
||||||
|
while read -r get_name; do
|
||||||
|
echo "Trying $get_name..."
|
||||||
|
mkdir -p "$configdir/_distros/$get_name" && cd "$configdir/_distros/$get_name" || exit
|
||||||
|
releases=$("$QUICKGET" "$get_name" | grep 'Releases:' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//')
|
||||||
|
echo "$releases" > releases
|
||||||
|
editions=$("$QUICKGET" "$get_name" | grep 'Editions:' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//')
|
||||||
|
echo "$editions" > editions
|
||||||
|
if [ -z "$editions" ]; then
|
||||||
|
for release in $releases; do
|
||||||
|
echo "$get_name" >> "$configdir/test"
|
||||||
|
timeout 10 "$QUICKGET" -t "$get_name" "${release}" >> "$configdir/test"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while read -r release; do
|
||||||
|
for edition in $editions; do
|
||||||
|
echo "$get_name" >> "$configdir/test"
|
||||||
|
timeout 10 "$QUICKGET" -t "$get_name" "${release}" "${edition}" >> "$configdir/test"
|
||||||
|
done
|
||||||
|
done < releases
|
||||||
|
fi
|
||||||
|
cd "$configdir" || exit
|
||||||
|
done < supported
|
||||||
|
printf "\nDone"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_ISOs_urls(){
|
||||||
|
rm -r "$configdir"
|
||||||
|
mkdir -p "$configdir" && cd "$configdir" || exit
|
||||||
|
touch "$configdir/test"
|
||||||
|
"$QUICKGET" | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > supported
|
||||||
|
while read -r get_name; do
|
||||||
|
echo "Trying $get_name..."
|
||||||
|
mkdir -p "$configdir/_distros/$get_name" && cd "$configdir/_distros/$get_name" || exit
|
||||||
|
releases=$("$QUICKGET" "$get_name" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//')
|
||||||
|
echo "$releases" > releases
|
||||||
|
editions=$("$QUICKGET" "$get_name" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//')
|
||||||
|
echo "$editions" > editions
|
||||||
|
if [ -z "$editions" ]; then
|
||||||
|
for release in $releases; do
|
||||||
|
echo "$get_name" >> "$configdir/test"
|
||||||
|
timeout 5 "$QUICKGET" -s "$get_name" "${release}" >> "$configdir/test" #&& $(killall zsync >> /dev/null)
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while read -r release; do
|
||||||
|
for edition in $editions; do
|
||||||
|
echo "$get_name" >> "$configdir/test"
|
||||||
|
timeout 5 "$QUICKGET" -s "$get_name" "${release}" "${edition}" >> "$configdir/test" #&& $(killall zsync >> /dev/null)
|
||||||
|
done
|
||||||
|
done < releases
|
||||||
|
fi
|
||||||
|
cd "$configdir" || exit
|
||||||
|
done < supported
|
||||||
|
printf "\nDone"
|
||||||
|
}
|
||||||
|
|
||||||
get_ssh_port() {
|
get_ssh_port() {
|
||||||
port=$(grep 'ssh' < "$selected".ports | cut -d',' -f2)
|
port=$(grep 'ssh' < "$selected".ports | cut -d',' -f2)
|
||||||
}
|
}
|
||||||
|
@ -190,6 +487,28 @@ open_distro_homepage(){
|
||||||
"$QUICKGET" -o "${os}" >/dev/null 2>&1 &
|
"$QUICKGET" -o "${os}" >/dev/null 2>&1 &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kill_vm() {
|
||||||
|
gum_choose_running
|
||||||
|
if [ -n "$selected" ]; then
|
||||||
|
echo "${selected}"
|
||||||
|
gum confirm "Really kill $selected?" && pid=$(cat "$selected".pid) && kill "$pid"
|
||||||
|
show_headers
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# test
|
||||||
|
kill_vms() {
|
||||||
|
gum_choose_runnings
|
||||||
|
if [ -n "$selected" ]; then
|
||||||
|
for vm_name in "${selected[@]}"; do
|
||||||
|
gum confirm "Really kill $vm_name?"
|
||||||
|
pid=$(cat "${vm_name}.pid")
|
||||||
|
kill "$pid"
|
||||||
|
done
|
||||||
|
show_headers
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
gum_choose_VM_to_delete() {
|
gum_choose_VM_to_delete() {
|
||||||
if [ -n "$(echo *.conf)" ]; then
|
if [ -n "$(echo *.conf)" ]; then
|
||||||
chosen=$(echo "${vms[@]%.*}" | tr " " "\n" | gum choose --select-if-one)
|
chosen=$(echo "${vms[@]%.*}" | tr " " "\n" | gum choose --select-if-one)
|
||||||
|
@ -200,32 +519,440 @@ gum_choose_VM_to_delete() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# MENU
|
## SETTINGS
|
||||||
_show_menu() {
|
|
||||||
|
headers_small_or() {
|
||||||
|
printf '\n\nsmall:\n'
|
||||||
|
show_headers_small
|
||||||
|
printf '\n\nfull:\n'
|
||||||
|
show_headers_full
|
||||||
|
printf '\n\ncurrent:\n'
|
||||||
|
show_headers
|
||||||
|
use_headers=$(gum choose --header " Use small headers or full?" "small" "full" "current")
|
||||||
|
echo "will use $use_headers"
|
||||||
|
show_headers
|
||||||
|
}
|
||||||
|
|
||||||
|
change_borders() {
|
||||||
|
title="Change borders style"
|
||||||
|
show_header
|
||||||
|
BORDER=$(echo "none
|
||||||
|
hidden
|
||||||
|
normal
|
||||||
|
rounded
|
||||||
|
thick
|
||||||
|
double" | gum filter --height $height)
|
||||||
|
mkdir -p ${configdir}
|
||||||
|
touch "${configdir}"/border
|
||||||
|
echo $BORDER > "${configdir}"/border
|
||||||
|
}
|
||||||
|
|
||||||
|
change_color() {
|
||||||
|
title="Define color number or choose random"
|
||||||
|
show_header
|
||||||
|
BORDER_FOREGROUND=$(echo 'random' | gum filter --height 1 --prompt="Enter custom" --no-strict)
|
||||||
|
mkdir -p ${configdir}
|
||||||
|
touch "${configdir}"/color
|
||||||
|
echo $BORDER_FOREGROUND > "${configdir}"/color
|
||||||
|
}
|
||||||
|
|
||||||
|
use_color() {
|
||||||
|
if [ -f "${configdir}/color" ]; then
|
||||||
|
BORDER_FOREGROUND=$(cat ${configdir}/color)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
change_spinner() {
|
||||||
|
spinner=$(echo "line
|
||||||
|
dot
|
||||||
|
minidot
|
||||||
|
jump
|
||||||
|
pulse
|
||||||
|
points
|
||||||
|
globe
|
||||||
|
moon
|
||||||
|
monkey
|
||||||
|
meter
|
||||||
|
hamburger" | gum filter --height 11)
|
||||||
|
mkdir -p ${configdir}
|
||||||
|
touch "${configdir}"/spinner
|
||||||
|
echo "$spinner" > "${configdir}"/spinner
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
icons_or() {
|
||||||
|
gum confirm " Use icons?
|
||||||
|
need Nerd Fonts" && echo "yes" > /tmp/icons || rm /tmp/icons
|
||||||
|
show_headers
|
||||||
|
}
|
||||||
|
|
||||||
|
use_icons() {
|
||||||
|
if [ -f /tmp/icons ]; then
|
||||||
|
icons=yes
|
||||||
|
else
|
||||||
|
icons=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## HEADERS
|
||||||
|
|
||||||
|
show_header() {
|
||||||
|
gum style --padding "0 1" --border="$BORDER" --border-foreground="$BORDERS_FOREGROUND" "$title"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_version_qemu() {
|
||||||
|
qemu-x86_64 -version | sed 2d | cut -d' ' -f3
|
||||||
|
}
|
||||||
|
|
||||||
|
show_version_quickemu() {
|
||||||
|
quickemu --version | grep "ERROR! QEMU not found" && echo "QEMU is missing!" || quickemu --version
|
||||||
|
}
|
||||||
|
|
||||||
|
show_editor() {
|
||||||
|
if [ -z "$EDITOR" ]; then
|
||||||
|
echo ' editor Not set!'
|
||||||
|
else
|
||||||
|
echo " editor $EDITOR"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_vms() {
|
||||||
|
if [ ${#vms[@]} -eq 0 ]; then
|
||||||
|
gum style --foreground 1 "No VMs!"
|
||||||
|
else
|
||||||
|
echo "${vms[@]%.*}" | tr " " "\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_custom_small() {
|
||||||
|
if [ -f "${configdir}/command" ]; then
|
||||||
|
gum style --bold --foreground "$color2" "command:"
|
||||||
|
gum style "quickemu $(cat "${configdir}/command")"
|
||||||
|
fi
|
||||||
|
if [ -f "${configdir}/default_vm_config" ]; then
|
||||||
|
gum style --bold --foreground "$color2" "default config:"
|
||||||
|
gum style "$(cat "${configdir}/default_vm_config")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_custom() {
|
||||||
|
show_custom_small
|
||||||
|
if [ -f "${configdir}/color" ]; then
|
||||||
|
gum style --bold --foreground "$color2" "color:"
|
||||||
|
gum style "$(cat "${configdir}/color")"
|
||||||
|
fi
|
||||||
|
if [ -f "${configdir}/border" ]; then
|
||||||
|
gum style --bold --foreground "$color2" "borders:"
|
||||||
|
gum style "$(cat "${configdir}/border")"
|
||||||
|
fi
|
||||||
|
if [ -f "${configdir}/spinner" ]; then
|
||||||
|
gum style --bold --foreground "$color2" "spinner:"
|
||||||
|
gum style "$(cat "${configdir}/spinner")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_header_vms() {
|
||||||
|
pid_files=(*/*.pid)
|
||||||
|
vms=(*.conf)
|
||||||
|
vms_running=()
|
||||||
|
vms_not=()
|
||||||
|
vms_vm=$(gum style --bold --foreground "$color2" "ready:")
|
||||||
|
vms_run=""
|
||||||
|
if [ -n "$(find . -name '*.pid')" ]; then
|
||||||
|
for pid_file in "${pid_files[@]}"; do
|
||||||
|
instance_name=$(basename "$pid_file" .pid)
|
||||||
|
vms_running+=("$instance_name")
|
||||||
|
done
|
||||||
|
if [ "$icons" == yes ]; then
|
||||||
|
running_logo=$(gum style --foreground "$color" --bold ".")
|
||||||
|
else
|
||||||
|
running_logo=$(gum style --foreground "$color" --bold ">")
|
||||||
|
fi
|
||||||
|
for instance in "${vms_running[@]}"; do
|
||||||
|
vms_run+="$running_logo$instance "
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
mapfile -t vms_not < <(comm -23 <(printf "%s\n" "${vms[@]}" | rev | cut -d'.' -f2-9 | rev | sort) <(printf "%s\n" "${vms_running[@]}" | sort))
|
||||||
|
vms_not_next=$(gum style --align center < <(printf '%s\n' "${vms_not[@]}"))
|
||||||
|
if [ -n "$(find . -name '*.pid')" ]; then
|
||||||
|
vms_run_next=$(echo "$vms_run" | tr " " "\n")
|
||||||
|
vms_header=$(gum join --vertical --align center "$vms_vm" "$vms_run_next" "$vms_not_next")
|
||||||
|
else
|
||||||
|
vms_header=$(gum join --vertical --align center "$vms_vm" "$vms_not_next")
|
||||||
|
fi
|
||||||
|
vms_border=$(gum style --padding "0 1" --border="$BORDER" --border-foreground $color "$vms_header")
|
||||||
|
header_vms=$(gum join --vertical --align left "$vms_border" "$tip_border")
|
||||||
|
}
|
||||||
|
|
||||||
|
show_header_tip() {
|
||||||
|
tip1=$(gum style --bold --foreground "$color2" "Tip: ")
|
||||||
|
tip2=$(gum style "try ")
|
||||||
|
tip3=$(shuf -n 1 /tmp/supported)
|
||||||
|
tip4=$(gum style --bold --foreground="$color" "$tip3")
|
||||||
|
tip5=$(gum join "$tip1" "$tip2" "$tip4")
|
||||||
|
tip6=$("$QUICKGET" -s "$tip3")
|
||||||
|
tip7=$(gum style "$tip6")
|
||||||
|
tip8=$(gum join --vertical --align top "$tip5" "$tip7")
|
||||||
|
header_tip=$(gum style --padding "0 1" --border="$BORDER" --border-foreground $color "$tip8")
|
||||||
|
}
|
||||||
|
|
||||||
|
show_headers_small() {
|
||||||
|
logo1=$(gum style --foreground "$color2" " ▄▄▄▄
|
||||||
|
█ █
|
||||||
|
█ █
|
||||||
|
█▄▀▄")
|
||||||
|
logo2=$(gum style "v$version")
|
||||||
|
logo3=$(gum style --foreground "$color2" "▀")
|
||||||
|
logo4=$(gum join "$logo2" "$logo3")
|
||||||
|
logo5=$(gum join --vertical "$logo1" "$logo4")
|
||||||
|
header_logo=$(gum style --padding "0 1" --border=rounded --border-foreground $color "$logo5" )
|
||||||
|
|
||||||
|
show_header_vms
|
||||||
|
show_header_tip
|
||||||
|
|
||||||
|
custom1=$(gum style --bold --foreground "$color2" "workdir:")
|
||||||
|
custom2=$(gum style "$(pwd)")
|
||||||
|
custom3=$(gum join --vertical --align center "$custom1" "$custom2" "$(show_custom_small)")
|
||||||
|
header_custom=$(gum style --padding "0 1" --border="$BORDER" --border-foreground="$color" "$custom3")
|
||||||
|
|
||||||
|
header12=$(gum join --vertical "$header_tip" "$header_custom")
|
||||||
|
header34=$(gum join "$header_logo" "$header12")
|
||||||
|
gum join --align top --vertical "$header34" "$header_vms"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_headers_full() {
|
||||||
|
logo0=$(gum style " simple VMs runner")
|
||||||
|
logo1=$(gum style --foreground "$color2" " ▄▄▄▄ ▄▄▄▄ ▄ ▄ ▄
|
||||||
|
█ █ █ █ █ █
|
||||||
|
█ █ █ █ █ █
|
||||||
|
█▄▀▄ █ █▄▄█ █")
|
||||||
|
logo2=$(gum style "v$version")
|
||||||
|
logo3=$(gum style --foreground "$color2" "▀")
|
||||||
|
logo4=$(gum style " for ")
|
||||||
|
logo5=$(gum style "quickemu")
|
||||||
|
logo6=$(gum join --align center --vertical "$logo0" "$logo1")
|
||||||
|
logo7=$(gum join "$logo2" "$logo3" "$logo4" "$logo5")
|
||||||
|
logo8=$(gum join --vertical "$logo6" "$logo7")
|
||||||
|
header_logo=$(gum style --align left --padding "0 1" --border=rounded --border-foreground $color "$logo8" )
|
||||||
|
|
||||||
|
header_dep=$(gum style --padding "0 1" --border="$BORDER" --border-foreground $color " qemu $(show_version_qemu)
|
||||||
|
quickemu $(show_version_quickemu)
|
||||||
|
$(show_editor)")
|
||||||
|
|
||||||
|
show_header_vms
|
||||||
|
show_header_tip
|
||||||
|
|
||||||
|
custom1=$(gum style --bold --foreground "$color2" "workdir:")
|
||||||
|
custom2=$(gum style "$(pwd)")
|
||||||
|
custom3=$(gum join --vertical --align center "$custom1" "$custom2" "$(show_custom)")
|
||||||
|
header_custom=$(gum style --padding "0 1" --border="$BORDER" --border-foreground="$color" "$custom3")
|
||||||
|
|
||||||
|
header1=$(gum join --vertical --align right "$header_logo" "$header_vms")
|
||||||
|
header2=$(gum join --vertical "$header_dep" "$header_custom" "$header_tip")
|
||||||
|
gum join --align top "$header1" "$header2"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_headers() {
|
||||||
|
if [ "$use_headers" == full ]; then
|
||||||
|
show_headers_full
|
||||||
|
else
|
||||||
|
show_headers_small
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## MENU
|
||||||
|
|
||||||
|
show_menus() {
|
||||||
|
if [ "$icons" == yes ]; then
|
||||||
|
show_menu_main_icons
|
||||||
|
else
|
||||||
|
show_menu_main
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu_main() {
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
start=$(echo "create
|
height=10
|
||||||
|
start=$(echo "create
|
||||||
run
|
run
|
||||||
|
OS homepage
|
||||||
ssh into
|
ssh into
|
||||||
homepage
|
kill
|
||||||
delete
|
delete
|
||||||
exit $progname" | gum filter --height 6)
|
icons
|
||||||
|
advanced
|
||||||
|
settings
|
||||||
|
help
|
||||||
|
exit $progname" | gum filter --height "$height")
|
||||||
# from choose: --selected ' run'
|
# from choose: --selected ' run'
|
||||||
case $start in
|
case $start in
|
||||||
create ) create_VM;;
|
create ) create_VM;;
|
||||||
run ) gum_choose_VM && run_VM;;
|
run ) gum_choose_VM && run_VM;;
|
||||||
'ssh into' ) ssh_into;;
|
'ssh into' ) ssh_into;;
|
||||||
homepage ) open_distro_homepage;;
|
'OS homepage' ) open_distro_homepage;;
|
||||||
delete ) gum_choose_VM_to_delete;;
|
kill ) kill_vm;;
|
||||||
"exit $progname" ) exit 0;;
|
delete ) gum_choose_VM_to_delete;;
|
||||||
esac
|
icons ) icons_or;;
|
||||||
|
'advanced' ) show_menu_advanced;;
|
||||||
|
'settings' ) show_menu_settings;;
|
||||||
|
'help' ) help_main; show_help;;
|
||||||
|
"exit $progname" ) exit 0;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu_main_icons() {
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
height=10
|
||||||
|
start=$(echo " create
|
||||||
|
run
|
||||||
|
OS homepage
|
||||||
|
ssh into
|
||||||
|
kill
|
||||||
|
delete
|
||||||
|
advanced
|
||||||
|
settings
|
||||||
|
help
|
||||||
|
exit $progname" | gum filter --height "$height")
|
||||||
|
# from choose: --selected ' run'
|
||||||
|
case $start in
|
||||||
|
' create' ) create_VM;;
|
||||||
|
' run' ) gum_choose_VM && run_VM;;
|
||||||
|
' ssh into' ) ssh_into;;
|
||||||
|
' OS homepage' ) open_distro_homepage;;
|
||||||
|
' kill' ) kill_vm;;
|
||||||
|
' delete' ) gum_choose_VM_to_delete;;
|
||||||
|
' icons' ) icons_or;;
|
||||||
|
' advanced' ) show_menu_advanced_icons;;
|
||||||
|
' settings' ) show_menu_settings_icons;;
|
||||||
|
' help' ) help_main; show_help;;
|
||||||
|
" exit $progname" ) exit 0;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu_advanced() {
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
title="advanced"
|
||||||
|
show_header
|
||||||
|
height=8
|
||||||
|
start=$(echo "test ISOs download
|
||||||
|
show ISOs URLs
|
||||||
|
set default config for VMs
|
||||||
|
edit VM config
|
||||||
|
custom quickemu command
|
||||||
|
add new distro
|
||||||
|
back to main menu
|
||||||
|
EXIT $progname" | gum filter --height "$height")
|
||||||
|
case $start in
|
||||||
|
'set default config for VMs' ) edit_default_VMs_config;;
|
||||||
|
'edit VM config' ) edit_VM_config;;
|
||||||
|
'custom quickemu command' ) custom_quickemu_command;;
|
||||||
|
'add new distro' ) add_new_distro;;
|
||||||
|
'test ISOs download' ) test_ISOs_download;;
|
||||||
|
'show ISOs URLs' ) show_ISOs_urls;;
|
||||||
|
'back to main menu') clear; show_headers; break;;
|
||||||
|
"exit $progname" ) exit 0;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu_advanced_icons() {
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
title="advanced"
|
||||||
|
show_header
|
||||||
|
height=8
|
||||||
|
start=$(echo " test ISOs download
|
||||||
|
show ISOs URLs
|
||||||
|
set default config for VMs
|
||||||
|
edit VM config
|
||||||
|
custom quickemu command
|
||||||
|
add distro
|
||||||
|
back to main menu
|
||||||
|
exit $progname" | gum filter --height "$height")
|
||||||
|
case $start in
|
||||||
|
' set default config for VMs' ) edit_default_VMs_config;;
|
||||||
|
' edit VM config' ) edit_VM_config;;
|
||||||
|
' custom quickemu command' ) custom_quickemu_command;;
|
||||||
|
' add distro' ) add_new_distro;;
|
||||||
|
' test ISOs download' ) test_ISOs_download;;
|
||||||
|
' show ISOs URLs' ) show_ISOs_urls;;
|
||||||
|
' back to main menu') clear; show_headers; break;;
|
||||||
|
" exit $progname" ) exit 0;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu_settings() {
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
title="settings"
|
||||||
|
show_header
|
||||||
|
height=10
|
||||||
|
start=$(echo "update $progname
|
||||||
|
regenerate supported
|
||||||
|
icons
|
||||||
|
accent color
|
||||||
|
borders color
|
||||||
|
borders style
|
||||||
|
spinner
|
||||||
|
headers
|
||||||
|
back to main menu
|
||||||
|
EXIT $progname" | gum filter --height "$height")
|
||||||
|
case $start in
|
||||||
|
"update $progname" ) update_quicktui;;
|
||||||
|
'regenerate supported' ) generate_supported;;
|
||||||
|
'icons' ) icons_or;;
|
||||||
|
'accent color' ) change_color;;
|
||||||
|
'borders color' ) change_color;;
|
||||||
|
'borders style' ) change_borders;;
|
||||||
|
'spinner' ) change_spinner;;
|
||||||
|
'headers' ) headers_small_or;;
|
||||||
|
'back to main menu') clear; show_headers; break;;
|
||||||
|
"exit $progname" ) exit 0;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu_settings_icons() {
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
title="settings"
|
||||||
|
show_header
|
||||||
|
height=10
|
||||||
|
start=$(echo " update $progname
|
||||||
|
regenerate supported
|
||||||
|
icons
|
||||||
|
accent color
|
||||||
|
borders color
|
||||||
|
borders style
|
||||||
|
spinner
|
||||||
|
headers
|
||||||
|
back to main menu
|
||||||
|
exit $progname" | gum filter --height "$height")
|
||||||
|
case $start in
|
||||||
|
" update $progname" ) update_quicktui;;
|
||||||
|
' regenerate supported' ) generate_supported;;
|
||||||
|
' icons' ) icons_or;;
|
||||||
|
' accent color' ) change_color;;
|
||||||
|
' borders color' ) change_color_border;;
|
||||||
|
' borders style' ) change_borders;;
|
||||||
|
' spinner' ) change_spinner;;
|
||||||
|
' headers' ) headers_small_or;;
|
||||||
|
' back to main menu') clear; show_headers; break;;
|
||||||
|
" exit $progname" ) exit 0;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# run
|
# run
|
||||||
#clear
|
#clear
|
||||||
_define_variables
|
define_variables
|
||||||
_if_needed
|
if_needed
|
||||||
|
use_icons
|
||||||
show_headers
|
show_headers
|
||||||
_show_menu
|
show_menus
|
||||||
|
|
Loading…
Reference in a new issue