gtDialog Reference

msgbox

Messageboxes

Arguments

Returns

The message box dialogs return a string containing the number of the button pressed, ‘0’ if the dialog timed out, or “-1” if the user canceled the dialog. If --string-output was given, the return string contains the label of the button pressed, “timeout” if the dialog timed out, or “delete” if the user canceled the dialog.

Example

gtdialog msgbox --title 'EOL Mode' --text 'Which EOL?' --icon dialog-question \
  --button1 CRLF --button2 CR --button3 LF

inputbox

Inputboxes

Arguments

Returns

The input dialogs return a string containing the number of the button pressed followed by a newline character (‘\n’) and the input text (with any multiple entries separated by newline characters), ‘0’ if the dialog timed out, or “-1” if the user canceled the dialog. If --string-output was given, the return string contains the label of the button pressed followed by a newline and the input text, “timeout” if the dialog timed out, or “delete” if the user canceled the dialog.

Example

gtdialog standard-inputbox --title 'Goto Line' --informative-text 'Line:' --text 1 --no-newline

fileselect

File Selection

Arguments

Returns

The file dialogs return a string containing the file(s) selected or the empty string if the user canceled the dialog.

Example

gtdialog fileselect --title 'Open C File' --with-directory $HOME  --with-extension c h \
  --select-multiple --no-newline

textbox

Textbox

Arguments

Returns

The textbox dialog returns a string containing the number of the button pressed and, if --editable was given, a newline character (‘\n’) followed by the textbox text; otherwise ‘0’ if the dialog timed out or “-1” if the user canceled the dialog. If --string-output was given, the return string contains the label of the button pressed and, if --editable was given, a newline followed by the textbox text; otherwise “timeout” if the dialog timed out or “delete” if the user canceled the dialog.

Example

gtdialog textbox --title 'License Agreement' --informative-text 'You agree to:' \
  --text-from-file LICENSE --button1 Ok

progressbar

Progressbar

Arguments

Returns

The progressbar dialog reads lines from standard input (stdin) or a callback function and updates the progressbar until the dialog receives an EOF or NULL. Input lines are of the form “num str\n” where “num” is a progress percentage between 0 and 100 and “str” is optional progress display text (GTK only). The newline character (‘\n’) is required. If “str” is empty, the current progress display text is retained. If --stoppable is given and “str” is either “stop disable” or “stop enable”, the Stop button is disabled or enabled, respectively. The dialog returns the string “stopped” only if --stoppable was given and the Stop button was pressed. Otherwise it returns nothing.

Example

for i in 25 50 75 100; do echo $i $i% done; sleep 1; done | \
  gtdialog progressbar --title 'Status' --width 200 --stoppable

dropdown

Arguments

Returns

The dropdown dialogs return a string containing the number of the button pressed (or ‘4’ if --exit-onchange was responsible) followed by a newline character (‘\n’) and the index of the selected item starting from 0, ‘0’ if the dialog timed out, or “-1” if the user canceled the dialog. If --string-output was given, the return string contains the label of the button pressed (or ‘4’, yes ‘4’, if --exit-onchange was responsible) followed by a newline and the selected item, “timeout” if the dialog timed out, or “delete” if the user canceled the dialog.

Example

gtdialog dropdown --title 'Select Encoding' --width 200
  --items UTF-8 ASCII ISO-8859-1 MacRoman --no-cancel --string-output --no-newline

filteredlist

Filtered List

Arguments

Returns

The filteredlist dialog returns a string containing the number of the button pressed followed by a newline character (‘\n’) and the index of the selected item(s) starting from 0, ‘0’ if the dialog timed out, or “-1” if the user canceled the dialog. If --string-output was given, the return string contains the label of the button pressed followed by a newline and the selected item(s) (based on --output-column, if applicable), “timeout” if the dialog timed out, or “delete” if the user canceled the dialog.

Example

gtdialog filteredlist --title Title --columns Foo Bar --items a b c d --no-newline

optionselect

Option Selection

Arguments

Returns

The optionselect dialog returns a string containing the number of the button pressed followed by a newline character (‘\n’) and the index of the selected options starting from 0, ‘0’ if the dialog timed out, or “-1” if the user canceled the dialog. If --string-output was given, the return string contains the label of the button pressed followed by a newline and the selected option(s), “timeout” if the dialog timed out, or “delete” if the user canceled the dialog.

Example

gtdialog optionselect --title Languages \
  --text 'Check the languages you understand' \
  --items English French German Romanian Russian Spanish Swedish \
  --select 0 2 --string-output --no-newline

colorselect

Color Selection (GTK Only)

Arguments

Returns

The colorselect dialog returns a string containing the color selected in “#RRGGBB” format, or the empty string if the user canceled the dialog.

Example

gtdialog colorselect --title Foreground --color "#FF0000" --no-newline

fontselect

Font Selection (GTK Only)

Arguments

Returns

The fontselect dialog returns a string containing the font selected (including style and size), or the empty string if the user canceled the dialog.

Example

gtdialog fontselect --title Font --font-name Monospace --font-size 10

Localization

For GTK only, button labels with GTK stock item labels are automatically localized. However, when --string-output is given, the stock item label is returned, not the actual, localized label. The default button labels are all stock item labels (“gtk-ok”, “gtk-cancel”, “gtk-yes”, and “gtk-no”).