How to show a GUI message box from a bash script in linux?
Everyone mentions zenity, there seem to be many others. A mixed up but interesting list is at http://alternativeto.net/software/zenity/
First, an example of zenity featuring text formatting markup, window title, button label.
zenity \--info \--text="<span size=\"xx-large\">Time is $(date +%Hh%M).</span>\n\nGet your <b>coffee</b>." \--title="Coffee time" \--ok-label="Sip"
gxmessage
gxmessage "my text"
xmessage
xmessage
is very old so it is stable and probably available in all distributions that use X (since it's distributed with X). It is customizable through X resources, for those that have been using Linux or Unix for long enough to know what it means (.Xdefaults
, anyone ?).
xmessage -buttons Ok:0,"Not sure":1,Cancel:2 -default Ok -nearmouse "Is xmessage enough for the job ?" -timeout 10
kdialog
(not tested)
In a PPA
YAD: Zenity On Steroids [Display Graphical Dialogs From Shell Scripts] ~ Web Upd8: Ubuntu / Linux blog. Does not seem to auto-size dialogs.
echo My text | yad \--text-info \--width=400 \--height=200
An bigger example
yad \--title="Desktop entry editor" \--text="Simple desktop entry editor" \--form \--field="Type:CB" \--field="Name" \--field="Generic name" \--field="Comment" \--field="Command:FL" \--field="Icon" \--field="In terminal:CHK" \--field="Startup notify:CHK" "Application" "Name" "Generic name" "This is the comment" "/usr/bin/yad" "yad" FALSE TRUE \--button="WebUpd8:2" \--button="gtk-ok:0" \--button="gtk-cancel:1"
Others not in Ubuntu standard repositories
- shellgui
- xdialog
- gtkdialog
Off-topic (for terminal)
whiptail --msgbox "my text" 10 20dialog --msgbox "my text" 10 20
Feel free to edit.