Zenity

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 13:28, 30 December 2018 by Admin (Talk | contribs)

Jump to: navigation, search

zenity (lower-case z) / formerly gdialog - have graphical GTK+ dialog boxes in command-line and shell scripts. Zenity adds graphical interfaces to shell scripts with a single command. Zenity is an open source and a cross-platform application


sample scripts

#!/bin/bash 
first=$(zenity --title="Your's First Name" --text "What is your first name?" --entry) 
zenity --info --title="Welcome" --text="Mr./Ms. $first" 
last=$(zenity --title="Your's Last Name" --text "$first what is your last name?" --entry) 
zenity --info --title="Nice Meeting You" --text="Mr./Ms. $first $last"


#!/bin/bash 
#zenity --list --title "Video Type?" --column="FPS" NTSC PAL

strPlayer="$1"
strPlayer=${strPlayer/"myth://user@192.168.254.88:6000"/"/mnt/mythtv/videos"}
echo $strPlayer >> /tmp/altplayer.log


varName1=$(zenity --list --title "$strPlayer" --column="FPS" NTSC PAL);
varName2=$(echo $varName1 | sed 's/[^a-zA-Z0-9]//g')

#zenity --error

#zenity --info --text="You selected $varName2";

case "${varName2}" in
        NTSC )
                zenity --info --text="Play standard NTSC video"
                vlc -f "$strPlayer" --no-embedded-video --no-sub-autodetect-file vlc://quit
                ;;
        PAL )
                zenity --info --text="Play at 96 percent for PAL"
                vlc -f "$strPlayer" --no-audio-time-stretch --rate=0.96 --no-embedded-video --no-sub-autodetect-file vlc://quit
                ;;
        * )
                zenity --error
                ;;
esac

exit 0