1. Yad List Dialog

Command
yad --list \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list
Figure 1. List dialog

1.1. --column=COLUMN[:TYPE]

Set the column header (TYPE - TEXT, NUM, FLT, CHK, RD, IMG or TIP).

Table 1. TYPE may be:
TYPE Description

TEXT

type is default (default)

NUM

For integers

FLT

For double values.

CHK

Checkboxes are a boolean columns.

RD

Radio toggle are a boolean columns.

IMG

May be path to image or icon name from current GTK+ icon theme. Size of icons may be set in gtk config file at GTK_ICON_SIZE_MENU position of gtk-icon-sizes. Images specified by icon names will be scaled to GTK_ICON_SIZE_MENU until --force-icon-size option is not sets. Image field prints as empty value.

icons

May be set in config file. Image field prints as empty value.

HD

Type means a hidden column. Such columns are not displayes in the list, only in output.

TIP

Type is used for define tooltip column.

Command
yad --list \
  --width=236 --height=101 \
  --column=Age:num \
  --column=Select:chk \
  --column=Comment:text \
  22 true Good
yad list column
Figure 2. List dialog with checkbox

1.2. --tree

Display list in tree mode

yad example 1 3 1
Figure 3. List in tree mode
yad example 1 3 2
Figure 4. List in tree mode expanded
Code
#!/bin/bash

yad --list \
  --tree \
  --column "Items" f Fruits 1:f Apple 2:f Lemon v Vegetables 3:v Popato 4:v Onion

1.2.1. --tree-expanded

Expand all tree nodes

1.3. --checklist

Use checkboxes for first column.

Command
yad --list --checklist \
  --width=302 --height=123 \
  --column=Tick \
  --column=Name \
  --column=Nickname \
  --column=Age \
  false William Bill 40 false Richard Dick 69
yad list CHK
Figure 5. Checklist dialog

1.4. --radiolist

Use checkboxes for first column.

Command
yad --list --radiolist \
  --width=302 --height=123 \
  --column=Tick --column=Name \
  --column=Nickname \
  --column=Age \
  false William Bill 40 false Richard Dick 69
yad list RD
Figure 6. Radiolist dialog

1.5. --no-headers

Don’t show column headers.

You need to use --column with the --list option but you don’t have to display the headers.

Command
yad --list --no-headers \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list no headers
Figure 7. List dialog --no-headers

1.6. --no-click

Disable clickable column headers
Disable sorting of column content by clicking on its header.

1.7. --multiple

Allow multiple rows to be selected.

Command
yad --list --multiple \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list multiple
Figure 8. List dialog --no-headers

1.8. --grid-lines=TYPE

Draw grid lines of type TYPE in list dialog.
TYPE can be one of the hor[izontal], vert[ical] of both.

1.9. --editable

Allow changes to text in some cases.

yad --list --editable \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list editable 1
Figure 9. Editable List
yad list editable
Figure 10. Editable List - changed Nickname for Richard

You can edit each of the fields. When you click on OK the changes will be parsed.

Output

Richard|George|69|

1.9.1. --editable-cols=LIST

Set the list of editable columns.
LIST must be a string of numbers separated by comma.

yad --list --editable --editable-cols="1,3" \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list editable cols 1
Figure 11. Column Age is editable
yad list editable cols 2
Figure 12. Column Name is editable

1.10. --print-all

Print all data from list.

Command
yad --list --print-all \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69

The --print-all option will parse all rows although I have only selected one.

yad list
Figure 13. List dialog --print-all
Output

William|Bill|40|
Richard|Dick|69|

1.11. --print-column=NUMBER

Print a specific column
Specify what column will be printed to standard output. 0 may be used to print all columns (this is default).

1.12. --hide-column=NUMBER

Hide a specific column.

Command
yad --list --hide-column=2 \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list hide column
Figure 14. --hide-column-2

The Nickname column is hidden.

1.13. --expand-column=NUMBER

Set the column expandable by default. 0 sets all columns expandable.

1.14. --search-column=NUMBER

Set the quick search column. Default is first column. Set it to 0 for disable searching.

1.15. --tooltip-column=NUMBER

Set the tooltip column.

1.16. --sep-column=NUMBER

Set the row separator column.
If the cell value from this column equal to specified row separator value such row will be draw as separator.
Separator value must be set.

1.17. --sep-value=TEXT

Set the TEXT as a row separator value.
This feature highly depends on your current GTK+ theme and may not work properly.

1.18. --limit=NUMBER

Set the number of rows in list dialog.
Will be shown only the last NUMBER rows. This option will take effect only when data reading from stdin.

1.19. --ellipsize=TYPE

Set ellipsize mode for text columns.
TYPE may be NONE, START, MIDDLE or END.

Command
yad --list --ellipsize=START \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list ellipsize start
Figure 15. ellipsize=START
Command
yad --list --ellipsize=MIDDLE \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list ellipsize middle
Figure 16. ellipsize=MIDDLE
Command
yad --list --ellipsize=END \
  --width=302 --height=123 \
  --column=Name \
  --column=Nickname \
  --column=Age \
  William Bill 40 Richard Dick 69
yad list ellipsize end
Figure 17. ellipsize=END

1.20. --dclick-action=CMD

Set double-click action.

When user double-clicked on row, CMD will be launched with values of all columns as an arguments.
By default double-click selects row and act as OK button for simple lists, set the checkbox if --checklist specified and do nothing when list run with --multiple option.
When double-click specified Enter acts as a double-click and Ctrl+Enter acts as an OK button. CMD may contain a special character %s for setting a position for arguments.
By default arguments will be concatenated to the end of CMD. If CMD starts with @, its output will replace values of current row.

This option doesn’t work with --editable.

Command
yad --list --dclick-action="ristretto" \
  --title="--dclick-action=CMD" \
  --width=300 --height=200 \
  --separator=" " \
  --column=Name \
  img/yad-list.png \
  img/yad-list-CHK.png \
  img/yad-list-column.png \
  img/yad-list-column.png
yad list dclick
Figure 18. List dialog --dclick-action

1.21. --select-action=CMD

Set select action
CMD will be launched with values of all columns as an arguments.
CMD may contain a special character %s for setting a position for arguments.
By default arguments will be concatenated to the end of CMD.
This option doesn’t work with --multiple.

1.22. --row-action=CMD

Set the CMD as a action when the row is added, modified or removed.
First argument for the command is the name of action (add, edit or del). The rest of command line is data from selected row. Output of this command sets the new row values.

Use regular expressions in search for text fields.

1.24. --no-selection

Disable selection in list.

1.25. --add-on-top

Add new records on the top of a list.

1.26. --simple-tips

Don’t use markup in tooltips

1.27. --header-tips

Use column name as a header tooltip

yad list header tips
Figure 19. header tips

2. Examples

2.1. Simple shopping list

Lets have a look at a really simple but useful shopping List example.

First create a text file called /home/USERNAME/shopping.list

Where USERNAME is your username on your computer.

In this list type or copy the following data:

shopping.list
true
milk
false
bread
false
eggs
false
butter
false
tomato soupg
false
flour
false
steak
false
sausages
false
carrots
true
beans

Here is the yad program that reads the file and lets you select the items.

Command
yad --list --checklist \
  --height=300 \
  --column=Buy \
  --column=Item < /home/USERNAME/shopping.list
yad list shopping
Figure 20. Shopping list

This is good but maybe you need to print the list so you can take it to the shop.

Command
yad --list --checklist \
  --button=yad-print:0 --button=yad-cancel:1 \
  --height=300 \
  --column=Buy \
  --column=Item < /home/USERNAME/shopping.list > /home/USERNAME/printlist \
  --print-column=2 --separator= && \
  yad --print --add-preview --filename=/home/USERNAME/printlist
yad list shopping 2
Figure 21. Shopping list with print button

As you can see the OK button has been replaced with a Print button.

When you click on print, the Print dialog is invoked. You can Print Preview then Print the list if you wish

Back to YAD Guide