How to show an message box from terminal in Ubuntu
11,161
Using zenity
:
sudo lsof | tee >(zenity --progress --pulsate) > out
zenity --question --text "Are you sure you want to shutdown?"; echo $?
zenity --warning --text "This will kill, are you sure?";echo $?
ans=$(zenity --scale --text "pick a number" --min-value=2 --max-value=100 --value=2 --step 2); echo "$ans"
sudo lsof | zenity --text-info --width 530
Using yad
Install yad
sudo apt-add repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install yad
Create a example script example
and add the lines below
#!/bin/bash
frmdata=$(yad --title "Test Form" --form --field "Address" --field="Name")
frmaddr=$(echo "$frmdata" | awk 'BEGIN {FS="|" } { print $1 }')
frmname=$(echo "$frmdata" | awk 'BEGIN {FS="|" } { print $2 }')
echo "$frmaddr"
echo "$frmname"
Or more complex:
yad --width=400 --title="" --text="Please enter your details:" \
--image="/usr/share/icons/Tango/scalable/emotes/face-smile.svg" \
--form --date-format="%-d %B %Y" --item-separator="," \
--field="Last name" \
--field="First name" \
--field="Date of birth":DT \
--field="Last holiday":CBE \
"" "" "Click calendar icon" "Gold Coast, Bali,Phuket, Sydney, other"
Using notify-send
notify-send "Hello" "Hello world"
Using dialog
dialog --msgbox "Hello world" 10 30
Using whiptail
whiptail --msgbox "Hello world" 10 30
Related videos on Youtube
Comments
-
Eskils almost 2 years
I want to show an message box from terminal in Ubuntu, I have GNOME 3 desktop environment.
How should I proceed?
-
g_p about 9 yearsshort answer is
zenity
. Useman zenity
for more information.
-
-
JoKeR about 9 years+1 I like too kinda fun also ;)
-
A.B. about 9 years@WhiteStone As you're a reputation 1 user: If this answer helped you, don't forget to click the grey ☑ at the left of this text, which means "yes, this answer is valid"! ;-)