Switch to dmenu function & delete zenity menu

This commit is contained in:
q3aql 2022-05-29 00:43:50 +02:00
parent 46896516fa
commit d99718cb2c

View File

@ -109,42 +109,62 @@ function checkFileCredentials() {
fi fi
} }
function aboutText() {
echo " ABOUT:"
echo ""
echo " Software: dmenu_protonvpn ${VERSION}"
echo " Author: q3aql"
echo " Contact: q3aql@duck.com"
echo " License: GPL v2.0"
echo ""
}
function showAbout() { function showAbout() {
zenity --title "About" --window-icon=${iconPath} --info --width=330 \ aboutText | /opt/dmenu_protonvpn/dmenu "$@" -p "嬨 dmenu_protonvpn v${VERSION}"
--text "Software: dmenu_protonvpn ${VERSION} (${M_DATE})\nAuthor: q3aql\nContact: q3aql@duck.com\nLicense: GPL v2.0" run_main
}
function downloadFilesText() {
echo "ﯲ DOWNLOAD PROTONVPN FILES:"
echo ""
echo " Steps for download .ovpn files:"
echo ""
echo "  Open URL: ${url_download}"
echo "  Login with your Proton account"
echo "  Click to Downloads > OpenVPN configuration files"
echo "  Download *.ovpn files and copy to ${HOME}/protonFiles"
echo ""
echo "  Press HERE for open URL with browser"
echo ""
} }
function downloadProtonVPNFiles() { function downloadProtonVPNFiles() {
openBrowser "${url_download}" select_output=$(downloadFilesText | /opt/dmenu_protonvpn/dmenu "$@" -p "嬨 dmenu_protonvpn v${VERSION}")
zenity --title "dmenu_protonvpn ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=400 \ if [ "${select_output}" == "  Press HERE for open URL with browser" ] ; then
--text "* Steps for download .ovpn files:\n\n - Open URL: ${url_download}\n - Login with your Proton account\n - Click to Downloads > OpenVPN configuration files\n - Download .ovpn files and copy to ${HOME}/protonFiles\n" openBrowser "${url_download}" &
run_main
else
run_main
fi
} }
list_output=$(list_show_icons | /opt/dmenu_protonvpn/dmenu "$@" -p "嬨 dmenu_protonvpn v${VERSION}") function run_main() {
run_output=$(echo "${list_output}" | cut -c4-999) echo "MAIN # Selected"
echo "${run_output} # Selected" list_output=$(list_show_icons | /opt/dmenu_protonvpn/dmenu "$@" -p "嬨 dmenu_protonvpn v${VERSION}")
if [ "${run_output}" == " About" ] ; then run_output=$(echo "${list_output}" | cut -c4-999)
if [ -f /usr/bin/zenity ] ; then echo "${run_output} # Selected"
if [ "${run_output}" == " About" ] ; then
showAbout showAbout
else elif [ "${run_output}" == " Download ProtonVPN files" ] ; then
echo ${termrun} ${menu_files}/about.sh
${termrun} ${menu_files}/about.sh
fi
elif [ "${run_output}" == " Download ProtonVPN files" ] ; then
if [ -f /usr/bin/zenity ] ; then
downloadProtonVPNFiles downloadProtonVPNFiles
else elif [ "${run_output}" == " Edit Credentials" ] ; then
echo ${termrun} "${menu_files}/download-protonvpn-files.sh"
${termrun} "${menu_files}/download-protonvpn-files.sh"
fi
elif [ "${run_output}" == " Edit Credentials" ] ; then
if [ -f /usr/bin/zenity ] ; then if [ -f /usr/bin/zenity ] ; then
editCredentials editCredentials
else else
echo ${termrun} "${menu_files}/edit-credentials.sh" echo ${termrun} "${menu_files}/edit-credentials.sh"
${termrun} "${menu_files}/edit-credentials.sh" ${termrun} "${menu_files}/edit-credentials.sh"
fi fi
else else
if [ -z "${run_output}" ] ; then if [ -z "${run_output}" ] ; then
echo > /dev/null echo > /dev/null
else else
@ -168,4 +188,9 @@ else
echo -ne "${green}+ Press ${end}${purple}ENTER${end}${green} to return menu${end} " ; read return echo -ne "${green}+ Press ${end}${purple}ENTER${end}${green} to return menu${end} " ; read return
fi fi
fi fi
fi fi
}
# Exec main function
run_main