Saturday, September 20, 2014

Menu driven.

Whether you prefer a graphical user interface such as:

Where all you have to do is just double click a picture is so sexy and seems very easy. Let's consider and alternative where all you have to do is just press a single key to start the program you want:

But then you could actually sort of do the same thing with an interface like this:

Oh but it is not as sexy some might say. It does exactly the same thing, but without using so many system resources. Not only that but you could get even more choices without having to redo the desktop. So if you pressed 1, you would get:

Or if you pressed 2 than you would get:

All this was done without any swiping!  Of course that does not prevent you from using your favorite program such as a spreadsheet or whatever:

But then you could do sort of the same thing with a text based alternative like homecalc or sc:

With all the embedded devices such as the Raspberry Pi and the like, you will want to be as resource conscious as you can.  Or to put it in another way, with all the impending issues in the world, what if computers, hand held devices and the like were stopped from being made? You still have to compute. What would you use? Those old systems in the closet do not look so bad now!?! Do not worry, computers will not be stop being made.

A bit of code:

echo "************************"
echo "* Music programs       *"
echo "************************"
echo "* [1] Autoharp         *"
echo "* [2] Radio            *"
echo "*                      *"
echo "* [0] Exit/Stop        *"
echo "************************"
echo "Enter your menu choice [1-2, or 0]: "
read -n 1 yourch
case $yourch in
1)  ;;
2) ;;
0) exit 0 ;;
*) echo "Oopps!!! Please select choice 1,2 or 0"
echo "Press Enter to continue. . ." ; read ;;

or a gui could be done:

#! /bin/bash

while selection=$(zenity --list \
"1 Autoharp" \
"2 Radio" \
"0 Exit/stop" \
--column="" --text="Music programs" --title="Menu")
case "$selection" in
"1 Autoharp");;
"2 Radio");;
"0 Exit") exit;;
*)  zenity --error --text="Invalid option. Try another one.";;


No comments:

Post a Comment