From 72b1397c19a0eafd1345ea2fed3f90ff20fe93b2 Mon Sep 17 00:00:00 2001 From: zenobit Date: Thu, 16 Mar 2023 17:37:46 +0100 Subject: [PATCH] v0.3 --- .gitignore | 1 + config/.config.kate-swp | Bin 252 -> 0 bytes dh | 113 +++++++++++++++++++++++++++++++++++++--- quickgui | 33 ------------ quicktui | 96 ---------------------------------- untitled | 18 ------- 6 files changed, 108 insertions(+), 153 deletions(-) delete mode 100644 config/.config.kate-swp delete mode 100755 quickgui delete mode 100755 quicktui delete mode 100644 untitled diff --git a/.gitignore b/.gitignore index c640255..aa91d7b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ config/vms_supported/ *.sock *.xml *.zs-old +*.kate-swp diff --git a/config/.config.kate-swp b/config/.config.kate-swp deleted file mode 100644 index 9b966c8bfd41159384b572847a7e596149d04eea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 252 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vn(fWO95noWkvgnw5>Khs#<{KRE;u(aH763{!>beF80cntO5MK~Y+7`hV w1Swa7nJon7xq__)X%/dev/null 2>&1; then + echo "You are missing yad..." >&2 + exit 1 fi +# run TUI instead +if [ $1 = -t ] ; then + printf '%s: v.%s\nquickemu: v.%s\n\n VMs dir: %s\n\n' "$progname" "$version" "$(quickemu --version)" "$(pwd)" + vms=(*.conf) + # Dependency check: check if fzf is installed and can be executed + if ! command -v fzf >/dev/null 2>&1; then + echo "You are missing fzf..." && exit 255 + fi + printf ' Prepared VMs:\n-------------\n' + # Check if there are any VMs + if [ ${#vms[@]} -eq 0 ]; then + echo "No VMs found." + exit 1 + fi + # Print the names of the available VMs + printf "%s\n" "${vms[@]%.conf}" + echo "-------------" + # Action prompt + printf " Do you want to create a new VM? (c) + or run an existing one? (press anything)\n" + read -rn 1 -s start + case $start in + c ) + todo="create" + ;; + esac + # If the user chose to create a new VM + if [ "$todo" = "create" ]; then + os=$(quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose OS to download + or CTRL-c or ESC to quit') + # If the OS is Windows + if [ "$os" = windows ]; then + answer=$(echo "Default English +Choose other language" | fzf --cycle) + # If the user wants another windows language + if [ "$answer" = "Choose other language" ]; then + wrelease=$(echo "8 +10 +11" | fzf --cycle) + # get window language list + wlend=$(($(cat quickget | sed '/Arabic/,$!d' | grep -n '}' | cut -d':' -f1 | head -n 1) - 1)) + # get windows language + wlang=$(cat quickget | sed '/Arabic/,$!d' | head -n $wlend | cut -d'=' -f2 | tail -c +2 | head -c -2 | sed 's/^[ \t]*//' | fzf --cycle --header='Choose Language + or CTRL-c or ESC to quit') + # downloading windows + printf '\n Trying to download Windows %s %s...\n\n' "$wrelease" "$wlang" + quickget "windows" "$wrelease" "$wlang" + fi + fi + # Get the release and edition to download, if necessary + choices=$(quickget "$os" | sed 1d) + if [ "$(echo "$choices" | wc -l)" = 1 ]; then + # get release + release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release + or CTRL-c or ESC to quit') + # downloading + printf '\n Trying to download %s %s...\n\n' "$os" "$release" + quickget "$os" "$release" + else + # get release + release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release + or CTRL-c or ESC to quit') + # get edition + edition=$(echo "$choices" | grep 'Editions' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Edition + or CTRL-c or ESC to quit') + # downloading + printf '\n Trying to download %s %s %s...\n\n' "$os" "$release" "$edition" + quickget "$os" "$release" "$edition" + fi + # choose VM to run + choosed=$(echo "$(ls ./***.conf 2>/dev/null | sed 's/\.conf$//')" | fzf --cycle --header='Choose VM to run + or CTRL-c or ESC to quit') + # Run choosed VM + printf '\n Starting %s...\n\n' "$choosed" + quickemu -vm "$choosed.conf" +fi +else + # run GUI + key=$((RANDOM % 9000 + 1000)) + GTK_THEME="alt-dialog" + CONFIG_DIR="$HOME/.config/distrohopper" + source "$CONFIG_DIR/distrohopper.conf" + yad --plug="$key" --tabnum=1 --icons --listen --read-dir="$CONFIG_DIR"/vms_ready --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 & + yad --plug="$key" --tabnum=2 --icons --listen --read-dir="$CONFIG_DIR"/vms_supported --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 & + yad --plug="$key" --tabnum=3 --icons --listen --read-dir="$CONFIG_DIR" --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 & + yad --dynamic --notebook --key="$key" --width=900 --height=800 --title="DistroHopper $version" --listen --no-buttons --tab="run VM" --tab="download VM" --tab="settings" +fi + +exit 0 diff --git a/quickgui b/quickgui deleted file mode 100755 index 147dc2c..0000000 --- a/quickgui +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -export LC_ALL=C - -version="0.3" -# DEBUG mod -#bash -x quickyad 2>&1 | tee output.log - -# YAD gui script using Forked excellent quickemu -#TODO Add homepages to right click - -echo "Running..." -# dependencies checks -if ! command -v yad >/dev/null 2>&1; then - echo "You are missing yad..." >&2 - exit 1 -fi -# generate random key for yad (for connecting tabs in notebook together) -key=$((RANDOM % 9000 + 1000)) - -# set current dir as QUICKEMU_VMS_DIR -#QUICKEMU_VMS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - -# distrohopper config file -CONFIG_DIR="$HOME/.config/distrohopper" -source "$CONFIG_DIR/distrohopper.conf" - -# show YAD notebook -yad --plug="$key" --tabnum=1 --icons --listen --read-dir="$CONFIG_DIR"/vms_ready --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 & -yad --plug="$key" --tabnum=2 --icons --listen --read-dir="$CONFIG_DIR"/vms_supported --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 & -yad --plug="$key" --tabnum=3 --icons --listen --read-dir="$CONFIG_DIR" --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 & -yad --dynamic --notebook --key="$key" --width=900 --height=800 --title="DistroHopper $version" --listen --no-buttons --tab="run VM" --tab="download VM" --tab="settings" -# exit peacfully -exit 0 diff --git a/quicktui b/quicktui deleted file mode 100755 index c2f0e73..0000000 --- a/quicktui +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/bash - -# Author: zenobit -# Description: Uses fzf to provide a simple GUI for quickemu and quickget -# script must be in same directory as quickget and quickemu! -# License MIT - -# Define variables -progname="${progname:="${0##*/}"}" -version="0.21" -vms=(*.conf) - -# Set traps to catch the signals and exit gracefully -trap "exit" INT -trap "exit" EXIT - -# Dependency check: check if fzf is installed and can be executed -if ! command -v fzf >/dev/null 2>&1; then - echo "You are missing fzf..." && exit 255 -fi -# Dispaly version and prepared VMs -#printf " $progname: $version\n quickemu: $(quickemu --version)\n\n Prepared VMs:\n-------------\n" -printf '%s: v.%s\nquickemu: v.%s\n\n Work dir.: %s\n\n Prepared VMs:\n-------------\n' "$progname" "$version" "$(quickemu --version)" "$(pwd)" -# Check if there are any VMs -if [ ${#vms[@]} -eq 0 ]; then - echo "No VMs found." - exit 1 -fi - -# Print the names of the available VMs -printf "%s\n" "${vms[@]%.*}" -echo "-------------" - -# Action prompt -printf " Do you want to create a new VM? (c) - or run an existing one? (press anything)\n" -read -rn 1 -s start -case $start in - c ) - todo="create" - ;; -esac - -# If the user chose to create a new VM -if [ "$todo" = "create" ]; then - os=$(quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose OS to download - or CTRL-c or ESC to quit') - # If the OS is Windows - if [ "$os" = windows ]; then - answer=$(echo "Default English -Choose other language" | fzf --cycle) - # If the user wants another windows language - if [ "$answer" = "Choose other language" ]; then - wrelease=$(echo "8 -10 -11" | fzf --cycle) - # get window language list - wlend=$(($(cat quickget | sed '/Arabic/,$!d' | grep -n '}' | cut -d':' -f1 | head -n 1) - 1)) - # get windows language - wlang=$(cat quickget | sed '/Arabic/,$!d' | head -n $wlend | cut -d'=' -f2 | tail -c +2 | head -c -2 | sed 's/^[ \t]*//' | fzf --cycle --header='Choose Language - or CTRL-c or ESC to quit') - # downloading windows - printf '\n Trying to download Windows %s %s...\n\n' "$wrelease" "$wlang" - quickget "windows" "$wrelease" "$wlang" - fi - fi - # Get the release and edition to download, if necessary - choices=$(quickget "$os" | sed 1d) - if [ "$(echo "$choices" | wc -l)" = 1 ]; then - # get release - release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release - or CTRL-c or ESC to quit') - # downloading - printf '\n Trying to download %s %s...\n\n' "$os" "$release" - quickget "$os" "$release" - else - # get release - release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release - or CTRL-c or ESC to quit') - # get edition - edition=$(echo "$choices" | grep 'Editions' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Edition - or CTRL-c or ESC to quit') - # downloading - printf '\n Trying to download %s %s %s...\n\n' "$os" "$release" "$edition" - quickget "$os" "$release" "$edition" - fi -fi -# choose VM to run -choosed=$(echo "$(ls *.conf 2>/dev/null | sed 's/\.conf$//')" | fzf --cycle --header='Choose VM to run - or CTRL-c or ESC to quit') - -# Run choosed VM -printf '\n Starting %s...\n\n' "$choosed" -quickemu -vm "$choosed.conf" - -exit 0 diff --git a/untitled b/untitled deleted file mode 100644 index 2c45f66..0000000 --- a/untitled +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# YAD gui script for creating YAD graphical user interfaces -# This version use desktop files and notebook - -# set app name - -# - -# create tab - -# create desktop file - -# create notebook logic - -# test script - -exit 0