1. Yad List Dialog
yad --list \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
1.1. --column=COLUMN[:TYPE]
Set the column header (TYPE - TEXT, NUM, FLT, CHK, RD, IMG or TIP).
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. |
yad --list \
--width=236 --height=101 \
--column=Age:num \
--column=Select:chk \
--column=Comment:text \
22 true Good
1.2. --tree
Display list in tree mode
#!/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.
yad --list --checklist \
--width=302 --height=123 \
--column=Tick \
--column=Name \
--column=Nickname \
--column=Age \
false William Bill 40 false Richard Dick 69
1.4. --radiolist
Use checkboxes for first column.
yad --list --radiolist \
--width=302 --height=123 \
--column=Tick --column=Name \
--column=Nickname \
--column=Age \
false William Bill 40 false Richard Dick 69
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.
yad --list --no-headers \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
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.
yad --list --multiple \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
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
You can edit each of the fields. When you click on OK the changes will be parsed.
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
1.10. --print-all
Print all data from list.
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.
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.
yad --list --hide-column=2 \
--width=302 --height=123 \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
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
.
yad --list --ellipsize=START \
--width=302 --height=123 \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
yad --list --ellipsize=MIDDLE \
--width=302 --height=123 \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
yad --list --ellipsize=END \
--width=302 --height=123 \
--column=Name \
--column=Nickname \
--column=Age \
William Bill 40 Richard Dick 69
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.
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
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.
1.23. --regex-search
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
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:
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.
yad --list --checklist \ --height=300 \ --column=Buy \ --column=Item < /home/USERNAME/shopping.list
This is good but maybe you need to print the list so you can take it to the shop.
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
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