#!/bin/bash ###################################################################### #Copyright (C) 2022 Kris Occhipinti #https://filmsbykris.com #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #You should have received a copy of the GNU General Public License #along with this program. If not, see . ###################################################################### #example of dialog/toaster messages on Desktop Linux and Android #suggested use it sourcing this file in your scripts #or pasting it into your code function msg_dialog(){ title="$1" msg="$2" if [[ `which yad` ]] then yad --title "$title" --text "$msg" elif [[ `which zenity` ]] then zenity --info --title="$title" --text="$msg" elif [[ `which termux-dialog` ]] then termux-dialog confirm -t "$title" -i "$msg" elif [[ `which whiptail` ]] then whiptail --title "$title" --msgbox "$msg" 8 78 else echo "===$title===" echo "$msg" fi } function msg_toaster(){ title="$1" msg="$2" if [[ `which notify-send` ]] then notify-send "$title" "$msg" elif [[ `which termux-toast` ]] then termux-toast "$title - $msg" else echo "==$title==" echo "$msg" fi } #example usage - remove after testing msg_dialog "title message" "This is a test" msg_toaster "Title Message" "This is a test msg"