initial migration to zenity

This commit is contained in:
2024-07-31 22:02:47 +01:00
parent 1f516c4347
commit 1d39086d19

View File

@@ -1,27 +1,29 @@
#! /bin/bash #! /bin/bash
if ! command -v dialog; then if ! command -v zenity; then
sudo apt-get install dialog -y sudo apt-get install zenity dialog -y
fi fi
# Set dialog colors
cp -f dotfiles/.dialogrc $HOME/.dialogrc
BACKTITLE="Trude's Linux Toolkit" BACKTITLE="Trude's Linux Toolkit"
dialog --erase-on-exit \
--backtitle "$BACKTITLE" \ options=(
--checklist "Use the arrow keys and SPACE to select, then press ENTER." 30 90 5 \ TRUE "Update OS"
"1" "Update OS" "on"\ TRUE "Copy Dotfiles"
"2" "Copy Dotfiles" "on"\ FALSE "Install DWM Desktop"
"3" "Install DWM Desktop" "off" \ TRUE "Configure GNOME"
"4" "Configure GNOME (dconf)" "on" \ TRUE "Install GitHub CLI"
"5" "Install GitHub CLI" "off"\ FALSE "Install Ollama"
"6" "Install Ollama" "off"\ TRUE "Install Apps (Enables Flatpak)"
"7" "Install Apps (Enables Flatpak)" "on"\ FALSE "Install Tailscale (VPN)"
"8" "Install Tailscale (VPN)" "on"\ FALSE "Install Syncthing"
"9" "Install Syncthing" "on" 2> choice.tmp )
main_menu=$( cat choice.tmp ) # Use zenity --list to display menu and capture chosen option
rm choice.tmp checkbox=$(zenity --list --checklist \
--title="$BACKTITLE" \
--column="Select" \
--column="Tasks" "${options[@]}")
readarray -td '|' choices < <(printf '%s' "$checkbox")
compile() { compile() {
cd programs/$1 cd programs/$1
@@ -29,10 +31,8 @@ compile() {
cd ../.. cd ../..
} }
for selection in $main_menu; do for selection in "${choices[@]}"; do
if [ "$selection" = "1" ]; then if [ "$selection" = "Update OS" ]; then
# --- UPDATE OS ---
dialogUpdate() { dialogUpdate() {
dialog --backtitle "$BACKTITLE" --title "Update Debian and Packages" \ dialog --backtitle "$BACKTITLE" --title "Update Debian and Packages" \
--mixedgauge "Updating..." \ --mixedgauge "Updating..." \
@@ -59,7 +59,7 @@ for selection in $main_menu; do
dialogUpdate 100 5 5 5 5 dialogUpdate 100 5 5 5 5
fi fi
if [ "$selection" = "2" ]; then if [ "$selection" = "Copy Dotfiles" ]; then
# Neovim # Neovim
dialog --erase-on-exit \ dialog --erase-on-exit \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
@@ -109,7 +109,7 @@ for selection in $main_menu; do
fc-cache -f fc-cache -f
fi fi
if [ "$selection" = "3" ]; then if [ "$selection" = "Install DWM Desktop" ]; then
clear clear
echo "---------------------------" echo "---------------------------"
echo "--- Install DWM Desktop ---" echo "--- Install DWM Desktop ---"
@@ -128,7 +128,7 @@ for selection in $main_menu; do
done done
fi fi
if [ "$selection" = "4" ]; then if [ "$selection" = "Configure GNOME" ]; then
clear clear
echo "-----------------------" echo "-----------------------"
echo "--- Configure GNOME ---" echo "--- Configure GNOME ---"
@@ -139,7 +139,7 @@ for selection in $main_menu; do
dconf load -f / < ./settings.dconf dconf load -f / < ./settings.dconf
fi fi
if [ "$selection" = "5" ]; then if [ "$selection" = "Install GitHub CLI" ]; then
clear clear
echo "----------------------" echo "----------------------"
echo "--- Install GH CLI ---" echo "--- Install GH CLI ---"
@@ -157,7 +157,7 @@ for selection in $main_menu; do
sudo apt install gh -y sudo apt install gh -y
fi fi
if [ "$selection" = "6" ]; then if [ "$selection" = "Install Ollama" ]; then
clear clear
echo "----------------------" echo "----------------------"
echo "--- Install Ollama ---" echo "--- Install Ollama ---"
@@ -169,7 +169,7 @@ for selection in $main_menu; do
curl -fsSL https://ollama.com/install.sh | sh curl -fsSL https://ollama.com/install.sh | sh
fi fi
if [ "$selection" = "7" ]; then if [ "$selection" = "Install Apps (Enables Flatpak)" ]; then
clear clear
echo "----------------------------" echo "----------------------------"
echo "--- Install Applications ---" echo "--- Install Applications ---"
@@ -213,7 +213,7 @@ for selection in $main_menu; do
done done
fi fi
if [ "$selection" = "8" ]; then if [ "$selection" = "Install Tailscale (VPN)" ]; then
clear clear
echo "-------------------------" echo "-------------------------"
echo "--- Install Tailscale ---" echo "--- Install Tailscale ---"
@@ -225,7 +225,7 @@ for selection in $main_menu; do
sudo tailscale up sudo tailscale up
fi fi
if [ "$selection" = "9" ]; then if [ "$selection" = "Install Syncthing" ]; then
clear clear
echo "-------------------------" echo "-------------------------"
echo "--- Install Syncthing ---" echo "--- Install Syncthing ---"