8

I want to show an message box from terminal in Ubuntu, I have GNOME 3 desktop environment.

How should I proceed?

A.B.
  • 90,397
Eskils
  • 173
  • 2
  • 4
  • 12

1 Answers1

19

Using zenity:

sudo lsof | tee >(zenity --progress --pulsate) > out

enter image description here


zenity --question --text "Are you sure you want to shutdown?"; echo $?

enter image description here


zenity --warning --text "This will kill, are you sure?";echo $?

enter image description here


ans=$(zenity --scale --text "pick a number" --min-value=2 --max-value=100 --value=2 --step 2); echo "$ans"

enter image description here


sudo lsof | zenity --text-info --width 530

enter image description here



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"

enter image description here


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"

enter image description here


Using notify-send

notify-send "Hello" "Hello world"

enter image description here

Using dialog

dialog --msgbox "Hello world" 10 30

enter image description here


Using whiptail

whiptail --msgbox "Hello world" 10 30

enter image description here

A.B.
  • 90,397