#!/bin/bash # MAIN MENU function mainMenu() { # select your position local CHOICE=$(zenity --list \ --title="Tutorial Video Player" --radiolist --width=400 --height=300 \ --text "Select where you wnat the video to display" \ --radiolist --column "Select" --column "Value" --column="Position Options" \ TRUE large "Large Center" \ FASLE left "Left Corner" \ FASLE right "Right Corner" \ FASLE topleft "Top Left Corner" \ FASLE topright "Top Right Corner" \ FASLE quit "Quit" \ --hide-column=2 2>/dev/null) # alwasy first stop videos playing stopVideo # triger the choise acction case $CHOICE in "large") showLarge ;; "left") showLeft ;; "right") showRight ;; "topleft") showTopleft ;; "topright") showTopright ;; "quit") quitProgram ;; esac # menu loop mainMenu } # show large center video function showLarge() { mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ -vf mirror -xy 2 tv:// -tv device=/dev/video4 -screen 1 & } # show video on bottom left function showLeft() { mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ -geometry 320x240+30+780 -vf mirror tv:// -tv device=/dev/video4 -screen 1 & } # show video on bottom right function showRight() { mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ -geometry 320x240+1570+780 -vf mirror tv:// -tv device=/dev/video4 -screen 1 & } # show video on top left function showTopleft() { mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ -geometry 320x240+30+30 -vf mirror tv:// -tv device=/dev/video4 -screen 1 & } # show video on top right function showTopright() { mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ -geometry 320x240+1570+30 -vf mirror tv:// -tv device=/dev/video4 -screen 1 & } # show video on top right function quitProgram() { stopVideo # end loop exit 0; } # stop videos playing function stopVideo() { ps aux | grep mplayer | awk '{print $2}' | xargs kill sleep 1 } # start program mainMenu