#!/bin/bash

#
# Script to the Applications menu for CLIbuntu
# 
#
while :
 do
    clear
    echo "-------------------------------------"
    echo "   CLIbuntu Applications Menu "
    echo "-------------------------------------"
    echo "[1] Office "
    echo "[2] Multimedia "
    echo "[3] Internet "
    echo "[4] Games "
    echo "[5] Utilities "
    echo "[6] System "
    echo "[7] Exit/Stop"
    echo "======================="
    echo -n "Enter your menu choice [1-7]: "
    read climenu
    case $climenu in
      1) while :
	   do
     		clear
         echo "----------------------------------------"
	 echo "         Office Applications  "
	 echo "----------------------------------------"
	 echo "[1] Text Editor (nano)"
	 echo "[2] Spreadsheet (slsc)"
	 echo "[3] Presentations (tpp) "
	 echo "[4] Address Book (contact script) "
	 echo "[5] Scheduling (when) "
	 echo "[6] Calendar (cal) "
	 echo "[7] To-Do List (ikog) "
	 echo "[8] Dictionary (dict) "
	 echo "[9] Typing Tutor "
	 echo "[10] Return to Main Menu"
	 echo "[11] Exit/Stop "
 	 echo "========================================"
	 echo -n "Enter your choice [1-11]: "
	 read offapp
	 case $offapp in
		1) nano ;;
		2) slsc ;;
		3) tpp ;;
		4) clear ; echo "Please type a first OR last name: " ; read name ; contact $name & ;; 
		5) clear ; when &  ;;
		6) clear ; cal -3 & ;;
		7) ikog  ;;
		8) clear ; echo " Please type word you would like defined: " ; read define ; dict $define & ;;  
		9) clear ; gtypist ;;
		10) break ;;
		11) exit 0 ;;
	 esac 
	done ;; 

      2)  while :
           do
                clear
         echo "----------------------------------------"
         echo "        Multimedia Applications   "
         echo "----------------------------------------"
         echo "[1] Listen to a Music File (juice)"
         echo "[2] Audio Mixer (alsa mixer)"
	 echo "[3] Listen to a CD (cdcd)"
         echo "[4] Play a Video File (mplayer)"
         echo "[5] Play a DVD (mplayer)"
	 echo "[6] View Pictures (fbi)"
	 echo "[7] View a PDF File "
	 echo "[8] Burn a CD/DVD (burnbash) "
         echo "[9] Return to Main Menu"
	 echo "[10] Exit/Stop "
         echo "========================================"
         echo -n "Enter your choice [1-10]: "
         read mmapp
         case $mmapp in
                1) juice ;;
                2) alsamixer ;;
                3) cdcd ;;
                4) clear ; 
			echo "Please type the full path of the directory your video file is located in: " ; 
			read videodir ; 
			pushd $videodir ; 
			ls ; 
			echo "You should now see a list of all your videos. Please type the full name of the video you would like to watch: " ;
			read mpvid ; 
			sudo mplayer -vo sdl "$mpvid" ; 
			read ; 
			popd ;; 
		5) clear ; 
			echo "Please make sure you have your DVD in the DVD drive....press any key when ready." ; 
			read ; 
			echo "Please type the DVD title number you would like to watch: " ; 
			read title ; 
			sudo mplayer -vo sdl dvd://$title ;;  
		6) clear ; 
			echo "Please type the full path of the directory containing your image files. Please end your path with a forward slash (i.e. /home/clibuntu/pics/)" ; 
			read images ; 
			fbi $images* & ;;
		7) clear ; 
			echo "Please type the full path of the PDF file: " ; 
			read pdf ; 
			fbgs -c "$pdf" ; 
			read ;;
 		8) bashburn ;;
                9) break ;;
		10) exit 0 ;;
         esac
        done ;;

      3)  while :
           do
                clear
         echo "----------------------------------------"
         echo "        Internet Applications  "
         echo "----------------------------------------"
         echo "[1] Browse the Internet (links)"
         echo "[2] Open Email Client (preconfigured mutt)"
	 echo "[3] Access Your Gmail Account in mutt "
	 echo "[4] Access POP3 Email Accounts in mutt"
	 echo "[5] Access IMAP Email Accounts in mutt"
         echo "[6] Instant Messenager (centericq)"
	 echo "[7] View Shared Network Directories (smbtree)"
         echo "[8] Access Your MS Windows Network (smbclient)"
         echo "[9] Bittorrent Client (rtorrent) "
         echo "[10] FTP "
         echo "[11] Return to Main Menu"
	 echo "[12] Exit/Stop "
         echo "========================================"
         echo -n "Enter your choice [1-12]: "
         read intapp
         case $intapp in
                1) links www.google.com ;;
                2) mutt ;;
		3) clear ; 
			echo "Please type your gmail username: " ; 
			read guser ; 
			mutt -f pops://$guser@pop.gmail.com ;;
		4) clear ; 
			echo "Please type your POP3 email account username: " ; 
			read popuser ; 
			clear ; 
			echo "Please type your POP3 server address (i.e. pop.server.com): " ; 
			read popserv ; 
			mutt -f pop://$popuser@$popserv ;;
		5) clear ; 
			echo "Please type your IMAP email account username: " ; 
			read imapuser ; 
			clear ; 
			echo "Please type your IMAP server address (i.e. imap.server.com): " ; 
			read imapserv ; 
			mutt -f imaps://$imapuser@$imapserv ;;
                6) clear ; centericq ;;
		7) clear ; smbtree & ;;
                8) clear ; 
			echo "Type the path of the shared directory in this manner //server/directory (see smbtree, menu item 4): " ; 
			read smbdir ; 
			clear ; 
			echo "Type the Ip address of the server: " ; 
			read smbip ; 
			smbclient $smbdir -I $smbip -U $USER ;; 
                9) clear ; 
			echo "Type the full path of your torrent file: " ; 
			read tor ; 
			rtorrent '$tor' & ;;
                10) clear ; 
			echo "Please type the ftp address (i.e ftp.host.com): " ; 
			read ftphost ; 
			ftp $ftphost ;; 
                11) break ;;
		12) exit 0 ;;
         esac
        done ;;

      4)  while :
           do
                clear
         echo "----------------------------------------"
         echo "               Games  "
         echo "----------------------------------------"
	 echo "[1] Adventure Game"
	 echo "[2] Math Quiz"
	 echo "[3] Backgammon " 
	 echo "[4] Battlestar "
	 echo "[5] Boggle "
         echo "[6] Solitaire "
         echo "[7] Cribbage"
         echo "[8] Go Fish"
         echo "[9] 5 in a Row"
         echo "[10] Dungeon Game "
         echo "[11] Hangman "
	 echo "[12] Monopoly "
	 echo "[13] Quiz Game "
	 echo "[14] Robots "
	 echo "[15] Snake "
	 echo "[16] Star Trek Game "
	 echo "[17] Moon Buggy "
	 echo "[18] Tetris "
	 echo "[19] Chess "
	 echo "[20] Go "
	 echo "[21] Tic Tac Toe "
         echo "[22] Return to Main Menu"
	 echo "[23] Exit/Stop"
         echo "========================================"
         echo -n "Enter your choice [1-23]: "
         read gamapp
         case $gamapp in
                1) adventure ;;
                2) arithmetic ;;
                3) backgammon ;;
                4) battlestar ;;
                5) boggle ;;
                6) canfield ;;
                7) cribbage ;;
		8) fish ;;
		9) gomoku ;;
		10) hack  ;;
		11) hangman ;;
		12) monop ;;
		13) quiz ;;
		14) robots ;;
		15) snake ;;
		16) trek ;;
		17) moon-buggy ;;
		18) tetris-bsd ;; 
		19) gnuchess ;;
		20) gnugo ;;
		21) nettoe ;; 
                22) break ;;
		23) exit 0 ;;
         esac
        done ;;

      5) while :
           do
                clear
         echo "----------------------------------------"
         echo "         Utilities   "
         echo "----------------------------------------"
         echo "[1] Set up a Scheduled Processes (cron)"
	 echo "[2] View all Scheduled Processes (cron)"
         echo "[3] View Date and Time "
         echo "[4] Return to Main Menu"
	 echo "[5] Exit/Stop "
         echo "========================================"
	 echo -n "Enter your choice [1-5]: "
         read utlapp
         case $utlapp in
                1) crontab -e ;;
                2) crontab -l & ;;
                3) clear ; date & ;;
                4) break ;;
		5) exit 0 ;;
         esac
        done ;;

      6) while :
           do
                clear
         echo "----------------------------------------"
         echo "        System Settings and Tools  "
         echo "----------------------------------------"
         echo "[1] View System Processes (top) "
         echo "[2] View Available Space on Drives (df)"
	 echo "[3] View Available RAM (free)"
	 echo "[4] View All Processes Running (ps)"
	 echo "[5] Kill a Process (kill)"
	 echo "[6] Manage Partitions *BE CAREFUL!* (fdisk)"
	 echo "[7] View All Programs Currently Installed"
	 echo "[8] Search for Programs by Keywords "
	 echo "[9] View a Description of a Program "
	 echo "[10] Install Programs "
	 echo "[11] Remove Programs "
         echo "[12] Return to Main Menu"
	 echo "[13] Exit/Stop "
         echo "========================================"
         echo -n "Enter your choice [1-13]: "
         read sysapp
         case $sysapp in
                1) top ;;
                2) clear ; df -h & ;;
		3) clear ; free -m & ;;
		4) clear ; ps -A & ;;
		5) clear ; 
			echo "Type the name of the process you would like to kill: " ; 
			read pskill ; 
			killall $pskill ; 
			echo "Process $pskill is dead!" & ;; 
		6) clear ; echo "Type device path (i.e. /dev/hda): " ; read device ; fdisk $device ;; 
		7) dpkg -l | sort | less ;;
		8) clear ; echo "To search for a program, type a keyword: " ; read key ; aptitude search $key ; read ;;
		9) clear ; echo "To view a description of a program, type the program: " ; read app ; aptitude show $app ; read ;;
		10) clear ; 
			echo "Type the name of the program you would like to install: " ; 
			read ins ; 
			sudo apt-get install $ins ; 
			clear ; 
			echo "$ins has been installed on your system." ; 
			read ;;
		11) clear ; echo "Type the name of the program you would like to remove: " ; read rem ; sudo apt-get remove $rem ; read ;;
                12) break ;;
		13) exit 0 ;;
         esac
        done ;;


      7) exit 0 ;;
      *) echo "Opps!!! Please select a choice between 1 and 8";
         echo "Press a key. . ." ; read ;;
 esac
done


