Added yad dialogues if in GUI session, retains the dialog interface if in console.
This commit is contained in:
@ -8,6 +8,16 @@
|
||||
|
||||
# Dialog accessibility
|
||||
export DIALOGOPTS='--no-lines --visit-items'
|
||||
|
||||
# Detect dialog interface type BEFORE potentially setting DISPLAY
|
||||
if [[ -z "$DISPLAY" ]]; then
|
||||
dialogType="dialog"
|
||||
else
|
||||
dialogType="yad"
|
||||
fi
|
||||
|
||||
# Source dialog interface wrapper
|
||||
source "${0%/*}/../.includes/dialog-interface.sh"
|
||||
# Turn off debug messages
|
||||
export WINEDEBUG="-all"
|
||||
# Make sure display is set in case installed from console.
|
||||
@ -21,9 +31,9 @@ prefix="https://www.cepstral.com/downloads/installers/windows/"
|
||||
|
||||
register() {
|
||||
local v="$1"
|
||||
company="$(dialog --clear --inputbox "Company name (leave empty if none)" -1 -1 --stdout)" || exit $?
|
||||
customer="$(dialog --clear --inputbox "Customer name" -1 -1 --stdout)" || exit $?
|
||||
key="$(dialog --clear --inputbox "License key" -1 -1 --stdout)" || exit $?
|
||||
company="$(agm_inputbox "Install Cepstral" "Install Cepstral" "Company name (leave empty if none)" "")" || exit $?
|
||||
customer="$(agm_inputbox "Install Cepstral" "Install Cepstral" "Customer name" "")" || exit $?
|
||||
key="$(agm_inputbox "Install Cepstral" "Install Cepstral" "License key" "")" || exit $?
|
||||
eval "wine \"c:\\Program Files\\Cepstral\\bin\\swift.exe\" --reg-voice --voice-name \"$v\" --customer-name \"$customer\" --company-name \"$company\" --license-key \"$key\""
|
||||
exit 0
|
||||
}
|
||||
@ -75,10 +85,7 @@ declare -a bottle
|
||||
for i in $(find ~/.local/wine/ -maxdepth 1 -type d -not -name 'wine' | sort) ; do
|
||||
bottle+=("$i" "${i##*/}")
|
||||
done
|
||||
export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
|
||||
--clear \
|
||||
--no-tags \
|
||||
--menu "Select A Wine Bottle" 0 0 0 "${bottle[@]}" --stdout)"
|
||||
export WINEPREFIX="$(agm_menu "Install Cepstral" "Install Cepstral" "Select A Wine Bottle" "${bottle[@]}")"
|
||||
|
||||
|
||||
if [[ -z "${WINEPREFIX}" ]]; then
|
||||
@ -90,10 +97,7 @@ if [[ "$1" == "-r" || "$1" == "--register" ]]; then
|
||||
action="register"
|
||||
fi
|
||||
|
||||
voice="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
|
||||
--clear \
|
||||
--no-tags \
|
||||
--menu "Select A voice to $action" 0 0 0 "${voices[@]}" --stdout)"
|
||||
voice="$(agm_menu "Install Cepstral" "Install Cepstral" "Select A voice to $action" "${voices[@]}")"
|
||||
|
||||
if [[ "$action" == "register" ]]; then
|
||||
register $voice
|
||||
@ -103,7 +107,7 @@ fi
|
||||
mkdir -p ~/Downloads
|
||||
|
||||
if ! [[ -e ~/Downloads/Cepstral_${voice}_windows_${version}.${msiexe} ]]; then
|
||||
wget -P ~/Downloads/ "${prefix}Cepstral_${voice}_windows_${version}.${msiexe}" | dialog --progressbox "Downloading voice..." -1 -1
|
||||
wget -P ~/Downloads/ "${prefix}Cepstral_${voice}_windows_${version}.${msiexe}" | agm_progressbox "Install Cepstral" "Downloading voice..."
|
||||
fi
|
||||
|
||||
# Get the install command.
|
||||
@ -114,7 +118,7 @@ cmd="${cmd} ~/Downloads/Cepstral_${voice}_windows_${version}.${msiexe}"
|
||||
# Install the voice
|
||||
(eval "$cmd" &
|
||||
[ "$msiexe" = "exe" ] && xdotool sleep 20 key --delay 75 alt+n key --delay 75 alt+a key --delay 75 alt+n key --delay 75 alt+o key --delay 75 alt+i sleep 20 key --delay 75 alt+f
|
||||
wineserver -w) | dialog --progressbox "installing voice..." -1 -1
|
||||
wineserver -w) | agm_progressbox "Install Cepstral" "Installing voice..."
|
||||
|
||||
# Make voices louder.
|
||||
find "${WINEPREFIX}/drive_c/Program Files/Cepstral/voices" -type d -not -name voices -exec bash -c 'for d ; do echo "GAIN 2.5" > "$d/default.sfx";done' _ {} \;
|
||||
|
Reference in New Issue
Block a user