Advertisement
metalx1000

Termux Dialog Example Script

Jan 18th, 2022
1,003
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/data/data/com.termux/files/usr/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2022  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation, either version 3 of the License, or
  9. #(at your option) any later version.
  10.  
  11. #This program is distributed in the hope that it will be useful,
  12. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. ######################################################################
  19.  
  20. a=$(termux-dialog spinner -t "Please Select A Name" -v "John,Jack,Jill" |jq .text)
  21. [[ "$a" == "John" ]] && echo Hey $a || echo Hello $a
  22.  
  23. a=$(termux-dialog sheet -t "Please Select A Name" -v "John,Jack,Jill" |jq .text)
  24. [[ "$a" == "John" ]] && echo Hey $a || echo Hello $a
  25.  
  26. termux-dialog checkbox -t "Please Select People" -v "John,Jack,Jill" |\
  27.   jq -r '.values[].text'|\
  28.   while read name
  29.   do
  30.     echo "$name has been selected."
  31.   done
  32.  
  33. #date select
  34. a="$(termux-dialog date -t "Please Select Your Birthday" )"
  35. #make sure ok is clicked
  36. code="$(echo $a|jq .code -r)"
  37. if [[ "$code" == "-1" ]]
  38. then
  39.   d="$(echo $a|jq .text -r)"
  40.   d="$(date -d "$d" "+%B %d")"
  41.   msg="Your Birthday is $d"
  42.   echo "$msg"
  43.   termux-dialog confirm -t "Your Birthday Is" -i "$msg"
  44. fi
  45.  
  46.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement