1. Yad Form
Display a form dialog.
holidays=$(echo "Gold Coast,Bali,Phuket,Sydney,other")
yad --title="My YAD Test" --text="Please enter your details:" \
--image="/usr/share/icons/hicolor/48x48/status/phone.png" \
--form --date-format="%-d %B %Y" --separator="," --item-separator="," \
--field="First Name" \
--field="Last Name" \
--field="Status":RO \
--field="Date of birth":DT \
--field="Last holiday":CBE \
--field="List your 3 favourite foods:":TXT \
"" "" "All round good guy" "Click calendar icon" "$holidays"

1.1. --field=LABEL[:TYPE]
Add field to form.
TYPE may be H
, RO
, NUM
, CHK
, CB
, CBE
, CE
, FL
, SFL
, DIR
, CDIR
, FN
, MFL
, MDIR
, DT
, SCL
, APP
, CLR
, BTN
, FBTN
, LBL
or TXT
.
TYPE |
Description |
H |
Hidden field type. |
RO |
Read Only field |
NUM |
Numeric field. |
CHK |
Checkbox filed. |
CB |
Combo-box field. |
CBE |
Editable combo-box field. |
CE |
Entry with completion. |
FL |
File selection button. |
SFL |
Field for create file. |
DIR |
Directory selection button. |
CDIR |
Field for create folder. |
FN |
Font selection button. |
MFL |
Select multiple files. |
MDIR |
Select multiple folders. |
DT |
Date field. |
SCL |
Scale field. |
SW |
switch field. |
APP |
application selection button. |
ICON |
Icon field. |
CLR |
Color selection button. |
BTN |
Button field. |
FBTN |
Same as button field, but with full relief of a button. |
LINK |
Link button field. |
LBL |
Text label. |
TXT |
Multiline text entry. |
![]() |
Without TYPE, field will be a simple text entry. |
This is a simple form using the --field widget.
yad --form --field=LABEL

There is alot of different field types as you can se above.
Lets go through them one by one.
1.1.1. H - Hidden
The Type: H Hides the text, like a password.

When you click on the OK button the text is revealed in the CLI (Command Line Interface).
123456|
![]() |
Notice the | (pipe) at the end of 123456, this is called a separator. More about that later. |
1.1.2. RO - Read Only
Type: RO means Read Only.
But if you run the following command:
yad --form --field=LABEL:RO

You won’t see any text so we need to add some default text like this:
yad --form --field=LABEL:RO "Default Text"

Now you can see some text but it’s greyed out.
1.1.3. NUM - Number
Type: NUM is for Numbers. Only numbers can be entered into this field.
yad --form --field=LABEL:NUM

Notice it has a spin box on the right hand side.
This can be used to increase or decrease the value.
To make this a bit more useful we can set a default number, lets make it 10.
yad --form --field=LABEL:NUM "10"

To control a Minimum and Maximum number, say 0.0 - 20.0:
yad --form --field="Number:NUM" 0\!0..20\!1\!1
![]() |
Notice the '\' escape characters. These are not required in a script but are from the CLI. I will provide a script example at the end of the form options. |
I hear you ask, what about fractions. Lets set the Minimum to 0.0 and the Maximum to 100.0 with 0.5 increments.
yad --form --field="Number:NUM" 0\!0..100\!0.5\!2

1.1.4. CHK - Checkbox
Type: CHK places a check box in the form.
yad --form --field="Number:CHK"

Checked returns True, Unchecked returns False
1.1.5. CB - Combo Box
Field Type: CB refers to Combo Box.
yad --form --field="ComboBox:CB" One\!Two\!Three
![]() |
Once again note the escape '\' characters. |


1.1.6. CBE - Combo Box Editable
Type: CBE means the Combo Box is Editable. In other words you can add data on the fly by typing.


You are not restricted to the three choices.
When you press OK in the above example
More Stuff| is returned.
1.1.7. CE - Entry with Completion
Field Type: CE completes a string from matching data. In the example below there are a number of vehicle makes. If you type h in the entry box you will be given a choice of vehicles listed that begin with h EG: Holden and Honda.
#!/bin/sh
yad --title="Vehicle Makes" \
--form \
--field ':CE' 'Holden!Ford!Toyota!Honda!Fiat!Mitsubishi!Nissan!\
Aston Martin!Rolls Royce!Jaguar!Renault!Bentley!Citroen'

Type in h and you’re given two choices.

1.1.8. FL - Folder List
Field type: FL is a Folder List.
yad --form --field="Folder List:FL"

Notice (None) is displayed, this is because a path was not specified.
Lets add a path to /home:
yad --form --field="Folder List:FL" /home

1.1.9. SFL - Select File List
Field Type: SFL means select a file from a list.
yad --form --field="Folder List:SFL" /home

Now you can drill down through the folders, starting at /home
, and select a file.
The output will be the full:
/path/filename|
1.1.10. DIR - Directory Structure
Field Type DIR display a basic directory structure.
yad --form --field="Folder List:DIR" /home

1.1.11. CDIR - Select/Create Folders
Field Type: CDIR is used to select or create folders.
yad --form --field="CDIR:CDIR" /home


1.1.12. FN - Font Dialog
Field type: FN is used to display a Font Picker.
yad --form --field="Font::FN"

When you click on the Font Button:

![]() |
Did you notice "Font::FN" in the command? The first colon is added to the Label and the second defines the field type. |
1.1.13. MFL - Multiple File List
Field Type: MFL allows you to select multiple files.
You need to hold the CTRL key while left mouse clicking to do so.
yad --form --field="Folder List:MFL" /home

The dialog looks the same as SFL however, when you select multiple files the /path/filenames
are separated by a '!'
/home/ingemar/Dokument/Yad-guide/output/07-form/img/yad-form.png!/home/ingemar/Dokument/Yad-guide/output/07-form/img/yad-form-field.png|
As you can see I selected two files.
1.1.14. MDIR - Select Folders
Field type: MDIR is used to select folders only.
yad --form --field="MDIR:MDIR" /home


1.1.15. DT - Date Picker
Field type: DT provides a Date Picker
yad --form --field="Date::DT"

Notice the little Calendar in the right of the field.
When you click on it, you get a Calendar.

Select the date and click on OK. The following is returned:
07/04/2021|
1.1.16. SCL - Scale field
Value of this field in a range 0..100.

1.1.17. SW - Switch field
Initial value is a case insensitive boolean constant (TRUE or FALSE).


1.1.18. ICON - Icon field
Like average entry field but has two icons. Left shows current icon and right is clickable and calls yad-icon-browser for choosing icon.

1.1.19. CLR - Color Picker
Field type: CLR provides a colour Picker.
yad --form --field="Color::CLR"

You can set a default colour by adding the Hex code:
yad --form --field="Color::CLR" "#F507D0"

Click the Button to open the Colour Selector.

To make a selection you must click on the triangle and press enter.
Clicking on the wheel just moves the triangle.
![]() |
In the Color name field you can type recognised names like teal to select a colour. There are hundreds defined so this may be an easier way to choose your colour. |
1.1.20. BTN - Button field
Field type: BTN is for making Buttons.
yad --form --field="Button:BTN"

Now a button wouldn’t be much use if it didn’t do something.
Now we add a command so it will open ristretto image viewer.
yad --form --field="Image Viewer:BTN" ristretto
1.1.21. FBTN - Button field
Same as button field, but with full relief of a button.

1.1.22. LINK
Field Type: LINK Link button field.
yad --form --field="Google":link http://www.google.com


1.1.23. LBL - Text label
If field name is empty, horizontal separator line will be shown.
![]() |
Whatever you put inside the quotes before the colon becomes the Label. |
yad --form --field="This is a Label Maaate:LBL"

1.1.24. TXT Text entry
Multiline text entry. This field is always occupy all of form width.
yad --form \
--field="Text::TXT" "This is a Text box where you can display various information."

1.2. --align
--align=TYPE
set alignment of filed labels (left, center or right).
yad --form --align=right --field="Label Aligned Right":LBL

Label aligned right. Left and Center is also possible.
1.3. --columns=NUMBER
Set number of columns in form.
#!/bin/sh
yad --form \
--columns=2 \
--field="Firstname:" "Billy" \
--field="Age:" "21" \
--field="Lastname:" "Bloggs" \
--field="Sex::"CB "Male!Female"

![]() |
Notice the order of the fields counting from top to bottom. The first two fields are on the left while 3rd and 4th fields are on the right. |
1.4. --homogeneous
Make form fields same height
1.5. --output-by-row
Order output fields by rows
Output field values row by row if several columns is specified.
1.6. --focus-field=NUMBER
Set focused field.

#!/bin/sh
# Written by Smokey01
# 20 April 2016
# Requires YAD and 01micko's mkwallpaper
yad --title="Make Wallpaper" --scroll --focus-field=2 --form --separator="," \
--field="Name:" "Slacko630" \
--field="Label:" "Slacko-6.3.0" \
--field="Font::FN" "Sans 50" \
--field="Format::CB" "png!svg" \
--field="Width:" "1024" \
--field="Height:" "768" \
--field="Embossed::CB" "Yes!No" \
--field="Gradient Offset::NUM" 0!0..1!0.05!2 \
--field="Gradient Angle::NUM" 0!0..20!0.05!2 \
--field="Colour::CLR" "#008080" \
"" "" "" "" "" "" "" "" "" "" | while read line; do
IMAGENAME=`echo $line | awk -F',' '{print $1}'`
LABELNAME=`echo $line | awk -F',' '{print $2}'`
FONT=`echo $line | awk -F',' '{print $3}'`
FORMAT=`echo $line | awk -F',' '{print $4}'`
WIDTH=`echo $line | awk -F',' '{print $5}'`
HEIGHT=`echo $line | awk -F',' '{print $6}'`
EMBOSSED=`echo $line | awk -F',' '{print $7}'`
OFFSET=`echo $line | awk -F',' '{print $8}'`
ANGLE=`echo $line | awk -F',' '{print $9}'`
COLOUR=`echo $line | awk -F',' '{print $10}'`
echo $NAME $LABEL $FONT $FORMAT $WIDTH $HEIGHT $EMBOSSED $OFFSET $ANGLE $COLOUR
# Convert the colour string xxxxxx to xx xx xx RGB
multi="0.003906"
red=`echo $COLOUR | cut -c2-3`
green=`echo $COLOUR | cut -c4-5`
blue=`echo $COLOUR | cut -c6-7`
# Convert colour string to decimal
fred="$((16#$red))"
fgreen="$((16#$green))"
fblue="$((16#$blue))"
# Scale the decimal numbers to 01micko's range
r=$(echo "$fred * $multi" | bc)
g=$(echo "$fgreen * $multi" | bc)
b=$(echo "$fblue * $multi" | bc)
# Separate font type from size
FONTY=`echo $FONT | awk '{ $NF = ""; print $0}'`
SIZEY=`echo $FONT | rev | cut -d' ' -f1 | rev`
# Run mkwallpaper, 01micko's cli application
mkwallpaper -n "$IMAGENAME" -l "$LABELNAME" -f "$FONTY" -p $FORMAT \
-x $WIDTH -y $HEIGHT -s $SIZEY -k $EMBOSSED -o "$OFFSET" -z "$r $g $b" -a $ANGLE
# Fixed a minor bug in the SVG format. Change pt to px to make sizing work properly .
sed -i 's/pt/px/g' /usr/share/backgrounds/"$IMAGENAME.svg"
# Display wallpaper
ristretto /usr/share/backgrounds/$IMAGENAME.$FORMAT
done
1.7. --cycle-read
Cycled reading of stdin dat
Sending FormFeed character clears the form. This symbol may be sent as echo -e '\f'
.
1.8. --align-buttons
Align labels on button fields
Align label on button fields according to --align settings
.
1.9. --changed-action=CMD
Set changed action
Run CMD when CHK
or CB
field values are changed. Command runs with two arguments - number of changed field and its currentvalue.
Output of a command parsing in a same manner as in BTN fields with @ prefix
.
![]() |
This option may slow down your dialog. |
1.10. --num-output
Output index of active element instead of text for combo-box fields.
1.11. --separator=SEPARATOR
The default separator
is the | symbol, also known as a pipe.
#!/bin/sh
yad --form \
--field="Firstname:" "Billy" \
--field="Lastname:" "Bloggs"
When you run the above script in a terminal you get this:

Then click OK you get this Output:
Billy|Bloggs|
Notice the pipes after Billy and Bloggs. This may be fine but what if you wanted spaces between Billy and Bloggs.
This is where you use the --separator command after the --form command. Let’s add --separator=" " to the original script.
#!/bin/sh
yad --form \
--separator=" " \
--field="Firstname:" "Billy" \
--field="Lastname:" "Bloggs"
The dialog looks the same but look at the output when OK is pressed.

Output: Billy Bloggs
1.12. --item-separator=SEPARATOR
Set the separator character for combobox or scale data.
You may have noticed on the --columns command I used a CB (Combo Box)
We want to add a few items to the CB so we need to use a separator character to separate them.
The default character is the exclamation mark !
#!/bin/sh
yad --form \
--field="Sex::"CB "Male!Female!Other"

Output: Male|
Now lets be bold and change both default separators, the --separator and --item-separator.
#!/bin/sh
yad --form \
--separator=" " \
--item-separator="," \
--field="Sex::"CB "Male,Female,Other"
The GUI looks the same but the CB choices are now separated by a comma instead of an exlamation mark and the pipe has disappeared from the end of the output. I selected Other and clicked on OK.
Output: Other
1.13. --date-format=PATTERN
Set the format for the returned date.
Run this script in a terminal:
#!/bin/sh
yad --form \
--separator=" " \
--date-format="%-d %B %Y" \
--field="Date:":DT

Click on the little calendar, choose a date, click OK
Output: 4 July 2021
%% a literal %
%a locale's abbreviated weekday name (Sun..Sat)
%A locale's full weekday name, variable length (Sunday..Saturday)
%b locale's abbreviated month name (Jan..Dec)
%B locale's full month name, variable length (January..December)
%c locale's date and time (Sat Nov 04 12:02:33 EST 1989)
%d day of month (01..31)
%D date (mm/dd/yy)
%e day of month, blank padded ( 1..31)
%h same as %b, locale's abbreviated month name (Jan..Dec)
%H hour :24 hour(00..23)
%I hour :12 hour(01..12)
%j day of year (001..366)
%k hour :24 hour(00..23)
%l hour :12 hour(01..12)
%m month (01..12)
%M minute (00..59)
%n a newline
%p locale's AM or PM
%r Time, 12-hour (hh:mm:ss [AP]M)
%s Seconds since 1970-01-01 00:00:00, (a GNU extension)
Note that this value is defined by the localtime system
call. It isn't changed by the '--date' option.
%S second (00..60)
%t a horizontal tab
%T Time, 24-hour (hh:mm:ss)
%U Week number of year with Sunday as first day of week (00..53)
%V Week number of year with Monday as first day of week (01..53)
If the week containing January 1 has four or
more days in the new year, then it is considered week 1;
otherwise, it is week 53 of the previous year, and the next week
is week 1. Similar to ISO 8601 (but not 100% compliant.)
%w day of week (0..6); 0 represents Sunday
%W week number of year with Monday as first day of week (00..53)
%x locale's date representation (mm/dd/yy)
%X locale's time representation (%H:%M:%S)
%y last two digits of year (00..99)
%Y year (1970...)
%z RFC-822 style numeric timezone (-0500) (a nonstandard extension)
This value reflects the current time zone.
Is not changed by the --date option.
%Z Time offset from UTC (-07) This generally consists of Time Zone+DST
Is not changed by the --date option.
1.14. --scroll
Make form scrollable.

#!/bin/sh
# Written by Smokey01
# 20 April 2016
# Requires YAD and 01micko's mkwallpaper
yad --title="Make Wallpaper" --scroll --form --separator="," \
--field="Name:" "Slacko630" \
--field="Label:" "Slacko-6.3.0" \
--field="Font::FN" "Sans 50" \
--field="Format::CB" "png!svg" \
--field="Width:" "1024" \
--field="Height:" "768" \
--field="Embossed::CB" "Yes!No" \
--field="Gradient Offset::NUM" 0!0..1!0.05!2 \
--field="Gradient Angle::NUM" 0!0..20!0.05!2 \
--field="Colour::CLR" "#008080" \
"" "" "" "" "" "" "" "" "" "" | while read line; do
IMAGENAME=`echo $line | awk -F',' '{print $1}'`
LABELNAME=`echo $line | awk -F',' '{print $2}'`
FONT=`echo $line | awk -F',' '{print $3}'`
FORMAT=`echo $line | awk -F',' '{print $4}'`
WIDTH=`echo $line | awk -F',' '{print $5}'`
HEIGHT=`echo $line | awk -F',' '{print $6}'`
EMBOSSED=`echo $line | awk -F',' '{print $7}'`
OFFSET=`echo $line | awk -F',' '{print $8}'`
ANGLE=`echo $line | awk -F',' '{print $9}'`
COLOUR=`echo $line | awk -F',' '{print $10}'`
echo $NAME $LABEL $FONT $FORMAT $WIDTH $HEIGHT $EMBOSSED $OFFSET $ANGLE $COLOUR
# Convert the colour string xxxxxx to xx xx xx RGB
multi="0.003906"
red=`echo $COLOUR | cut -c2-3`
green=`echo $COLOUR | cut -c4-5`
blue=`echo $COLOUR | cut -c6-7`
# Convert colour string to decimal
fred="$((16#$red))"
fgreen="$((16#$green))"
fblue="$((16#$blue))"
# Scale the decimal numbers to 01micko's range
r=$(echo "$fred * $multi" | bc)
g=$(echo "$fgreen * $multi" | bc)
b=$(echo "$fblue * $multi" | bc)
# Separate font type from size
FONTY=`echo $FONT | awk '{ $NF = ""; print $0}'`
SIZEY=`echo $FONT | rev | cut -d' ' -f1 | rev`
# Run mkwallpaper, 01micko's cli application
mkwallpaper -n "$IMAGENAME" -l "$LABELNAME" -f "$FONTY" -p $FORMAT \
-x $WIDTH -y $HEIGHT -s $SIZEY -k $EMBOSSED -o "$OFFSET" -z "$r $g $b" -a $ANGLE
# Fixed a minor bug in the SVG format. Change pt to px to make sizing work properly .
sed -i 's/pt/px/g' /usr/share/backgrounds/"$IMAGENAME.svg"
# Display wallpaper
ristretto /usr/share/backgrounds/$IMAGENAME.$FORMAT
done
1.15. Additional data
Additional data in command line interprets as a default values for form fields.
A special value @disabled@
makes corresponding field inactive.
If no extra arguments specified in a command line, data will be readed
from stdin, one value per line. Cycled reading means that for N
fields
N+1
value will replace the first field.
Empty values are skipped when reading from stdin.
1.16. Form Examples
#!/bin/sh
# Written by Smokey01
# 20 April 2016
# Requires YAD and 01micko's mkwallpaper
yad --title="Make Wallpaper" --form --separator="," \
--field="Name:" "Slacko630" \
--field="Label:" "Slacko-6.3.0" \
--field="Font::FN" "Sans 50" \
--field="Format::CB" "png!svg" \
--field="Width:" "1024" \
--field="Height:" "768" \
--field="Embossed::CB" "Yes!No" \
--field="Gradient Offset::NUM" 0!0..1!0.05!2 \
--field="Gradient Angle::NUM" 0!0..20!0.05!2 \
--field="Colour::CLR" "#008080" \
"" "" "" "" "" "" "" "" "" "" | while read line; do
IMAGENAME=`echo $line | awk -F',' '{print $1}'`
LABELNAME=`echo $line | awk -F',' '{print $2}'`
FONT=`echo $line | awk -F',' '{print $3}'`
FORMAT=`echo $line | awk -F',' '{print $4}'`
WIDTH=`echo $line | awk -F',' '{print $5}'`
HEIGHT=`echo $line | awk -F',' '{print $6}'`
EMBOSSED=`echo $line | awk -F',' '{print $7}'`
OFFSET=`echo $line | awk -F',' '{print $8}'`
ANGLE=`echo $line | awk -F',' '{print $9}'`
COLOUR=`echo $line | awk -F',' '{print $10}'`
echo $NAME $LABEL $FONT $FORMAT $WIDTH $HEIGHT $EMBOSSED $OFFSET $ANGLE $COLOUR
# Convert the colour string xxxxxx to xx xx xx RGB
multi="0.003906"
red=`echo $COLOUR | cut -c2-3`
green=`echo $COLOUR | cut -c4-5`
blue=`echo $COLOUR | cut -c6-7`
# Convert colour string to decimal
fred="$((16#$red))"
fgreen="$((16#$green))"
fblue="$((16#$blue))"
# Scale the decimal numbers to 01micko's range
r=$(echo "$fred * $multi" | bc)
g=$(echo "$fgreen * $multi" | bc)
b=$(echo "$fblue * $multi" | bc)
# Separate font type from size
FONTY=`echo $FONT | awk '{ $NF = ""; print $0}'`
SIZEY=`echo $FONT | rev | cut -d' ' -f1 | rev`
# Run mkwallpaper, 01micko's cli application
mkwallpaper -n "$IMAGENAME" -l "$LABELNAME" -f "$FONTY" -p $FORMAT \
-x $WIDTH -y $HEIGHT -s $SIZEY -k $EMBOSSED -o "$OFFSET" -z "$r $g $b" -a $ANGLE
# Fixed a minor bug in the SVG format. Change pt to px to make sizing work properly .
sed -i 's/pt/px/g' /usr/share/backgrounds/"$IMAGENAME.svg"
# Display wallpaper
ristretto /usr/share/backgrounds/$IMAGENAME.$FORMAT
done
This is what it looks like.
