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,34 +109,54 @@ 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
} }
function run_main() {
echo "MAIN # Selected"
list_output=$(list_show_icons | /opt/dmenu_protonvpn/dmenu "$@" -p "嬨 dmenu_protonvpn v${VERSION}") list_output=$(list_show_icons | /opt/dmenu_protonvpn/dmenu "$@" -p "嬨 dmenu_protonvpn v${VERSION}")
run_output=$(echo "${list_output}" | cut -c4-999) run_output=$(echo "${list_output}" | cut -c4-999)
echo "${run_output} # Selected" echo "${run_output} # Selected"
if [ "${run_output}" == " About" ] ; then if [ "${run_output}" == " About" ] ; then
if [ -f /usr/bin/zenity ] ; then
showAbout showAbout
else
echo ${termrun} ${menu_files}/about.sh
${termrun} ${menu_files}/about.sh
fi
elif [ "${run_output}" == " Download ProtonVPN files" ] ; then elif [ "${run_output}" == " Download ProtonVPN files" ] ; then
if [ -f /usr/bin/zenity ] ; then
downloadProtonVPNFiles downloadProtonVPNFiles
else
echo ${termrun} "${menu_files}/download-protonvpn-files.sh"
${termrun} "${menu_files}/download-protonvpn-files.sh"
fi
elif [ "${run_output}" == " Edit Credentials" ] ; then elif [ "${run_output}" == " Edit Credentials" ] ; then
if [ -f /usr/bin/zenity ] ; then if [ -f /usr/bin/zenity ] ; then
editCredentials editCredentials
@ -169,3 +189,8 @@ else
fi fi
fi fi
fi fi
}
# Exec main function
run_main