Freitag, 27. November 2015

VHS 2.6e

The new VHS provides several .desktop files,
  • to ease association to play audio and video files directly from GUI
  • to start screen-, webcam, or guide- recording directly
  • to configure VHS from the settings menu.
Get the latest tarball: https://github.com/sri-arjuna/vhs/releases/tag/v2.6e
Or download from github directly:

git clone https://github.com/sri-arjuna/vhs.git
cd vhs
./configure --prefix=/usr
./make-install

Hope you like it, enjoy!

Samstag, 21. November 2015

Two advanced simple bash menus

Many times one comes along a situation one wants to present a menu.
There are many ways to achieve this, none is wrong, none is right - each has its own value for its own situation.
However, to maintain or extend an existing menu can be hard to manage, at times.

I'd like to present you two of my favorite menu styles/types.
Hope you like them. :)

Variables:

Lets say you have a bunch of lists to handle, that you would like to present as menu...
It takes the variable prefix BUY_ and lists only the 'suffix' as menu content.
Simply add a new variable, and it will be listed in the menu.
Simply rename an existing variable, and as long the prefix BUY_ exists, it will be applied to the menu.
## Uncomment the variable assignments, to extend the menu
## Alll the menu 'management' can be done 'up here'
    BUY_FRUITS="apple banana kiwi"
    #BUY_PROTEIN="steak lenses"
    #BUY_DRINK="water milk limo"

## Expand/List all variables starting with BUI_
    MENU="${!BUY_*}"

## Loops the menus
while :;do
    echo "What variable to expand?"
   
    ## Cut of BUY_ from all (//) items of the list MENU
    select item in ${MENU//BUY_} Quit;do break;done
   
    ## Let the user Quit the loop
    [ Quit = $item ] && break
   
    ## RE-append the leading BUY_ variable prefix
    sel_item=BUY_$item
   
    ## Finaly expand / list the content of sel_item (BUY_$item).
    ## These 2 echo's should replace your function
    echo "${!sel_item}"
    echo
done

Array:

Lets say you have a bunch of tasks which you want to describe, and you know you might require to change the description.
This way, you only need to change the description in the array, and it keeps working.

    # Make sure no entries remain from possible previous runs
    unset MENU
   
    # Fill the values
    MENU[0]="First menu entry"
    MENU[1]="Menu entry one"
    MENU[2]="All good things are three"
   
    # Let the user select
    select choice in Quit "${MENU[@]}";do
        # Act accordingly
        # Its recomended to call functions from here, so the menu remains 'over-see-able'
        case "$choice" in
        Quit)        break        ;;
        "${MENU[0]}")    echo "first"    ;;
        "${MENU[1]}")    echo "second"    ;;
        "${MENU[2]}")    echo "third"    ;;
        esac
    done
Have fun tweaking!