1. Yad Form

Display a form dialog.

Code
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"
yad form
Figure 1. Form dialog example

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.
All characters are displayed as the invisible character.

RO

Read Only field

NUM

Numeric field.
Inital value format for thisfield is VALUE[!RANGE[!STEP![PREC]]], where RANGE must be in the form of MIN..MAX. ! is the default separator.
PREC is a precision for decimals.

CHK

Checkbox filed.
Initialvalue is a case insensitive boolean constant (TRUE or FALSE).

CB

Combo-box field.
Initial value is a list VAL1!VAL2!…​.
The separator is the same as in NUM field. Value started with ^ threats as default for combo-box.

CBE

Editable combo-box field.
Initial value same as for combo-box.

CE

Entry with completion.
Initial value same as for combo-box.

FL

File selection button.

SFL

Field for create file.

DIR

Directory selection button.

CDIR

Field for create folder.

FN

Font selection button.
Initial value same as in font dialog.

MFL

Select multiple files.
Value of this field is a list of files separated by item-separator.

MDIR

Select multiple folders.
Value of this field is a list of folders separated by item-separator.

DT

Date field.

SCL

Scale field.
Value of this field in a range 0..100.

SW

switch field.
Initial value is a case insensitive boolean constant (TRUE or FALSE).

APP

application selection button.
Input value for this field is mime-type.
Output value - executable for selected application.

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.

CLR

Color selection button.
Output values for this field generates in the same manner as for color dialog.

BTN

Button field.
Label may be in the form LABEL[!ICON[!TOOLTIP]] where '!' is an item separator.
LABEL is a text of button label or yad stock id.
ICON is a buttons icon (stock id or file name).
TOOLTIP is an optional text for popup help string.
Initial value is a command which is running when button is clicked.
A special sympols %N in command are replaced by value of field N. If command starts with @, the output of command will be parsed and lines started with number and colon will be treats as a new field values.
A quoting style for value when sh -c is used - a single quotes around command and double quotes around -c argument

FBTN

Same as button field, but with full relief of a button.

LINK

Link button field.

LBL

Text label.
If field name is empty, horisontal separator line will be shown.

TXT

Multiline text entry.
This field is always occupy all of form width.

Note Without TYPE, field will be a simple text entry.

This is a simple form using the --field widget.

Command
yad --form --field=LABEL
yad form field
Figure 2. Form dialog with a 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.

yad form field H
Figure 3. Form dialog with hidden characters

When you click on the OK button the text is revealed in the CLI (Command Line Interface).
123456|

Note 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:

Command
yad --form --field=LABEL:RO
yad form field RO 1
Figure 4. Form dialog with a read only field

You won’t see any text so we need to add some default text like this:

command
yad --form --field=LABEL:RO "Default Text"
yad form field RO 2
Figure 5. Form dialog with read only field with 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.

Command
yad --form --field=LABEL:NUM
yad form field NUM
Figure 6. Form dialog with a number field

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.

Command
yad --form --field=LABEL:NUM "10"
yad form field NUM 10
Figure 7. Form dialog with a number field with a default number

To control a Minimum and Maximum number, say 0.0 - 20.0:

Command
yad --form --field="Number:NUM" 0\!0..20\!1\!1
Note 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.

Command
yad --form --field="Number:NUM" 0\!0..100\!0.5\!2
yad form field NUM 100
Figure 8. Form dialog with number field and 2 decimals

1.1.4. CHK - Checkbox

Type: CHK places a check box in the form.

Command
yad --form --field="Number:CHK"
yad form field CHK
Figure 9. Form dialog with a checkbox

Checked returns True, Unchecked returns False

1.1.5. CB - Combo Box

Field Type: CB refers to Combo Box.

Command
yad --form --field="ComboBox:CB" One\!Two\!Three
Note Once again note the escape '\' characters.
yad form field CB 1
Figure 10. Combo box
yad form field CB 2
Figure 11. Combobox when clicked on the combo box

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.

yad form field CBE 1
Figure 12. Combo box editable
yad form field CBE 2
Figure 13. Combo box editable expanded

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.

Code
#!/bin/sh
yad --title="Vehicle Makes" \
  --form \
  --field ':CE' 'Holden!Ford!Toyota!Honda!Fiat!Mitsubishi!Nissan!\
  Aston Martin!Rolls Royce!Jaguar!Renault!Bentley!Citroen'
yad form field CE 1
Figure 14. The entry is initial empty.

Type in h and you’re given two choices.

yad form field CE 2
Figure 15. Entry with competion

1.1.8. FL - Folder List

Field type: FL is a Folder List.

Command
yad --form --field="Folder List:FL"
yad form field FL 1
Figure 16. Folder List dialog.

Notice (None) is displayed, this is because a path was not specified.
Lets add a path to /home:

Command
yad --form --field="Folder List:FL" /home
yad form field FL 2
Figure 17. Folder List dialog /home

1.1.9. SFL - Select File List

Field Type: SFL means select a file from a list.

Command
yad --form --field="Folder List:SFL" /home
yad form field SFL
Figure 18. Select Folder List dialog /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.

Command
yad --form --field="Folder List:DIR" /home
yad form field DIR
Figure 19. Directory Structure

1.1.11. CDIR - Select/Create Folders

Field Type: CDIR is used to select or create folders.

Command
yad --form --field="CDIR:CDIR" /home
yad form field CDIR1
Figure 20. CDIR
yad form field CDIR
Figure 21. CDIR when clicked on the folder icon

1.1.12. FN - Font Dialog

Field type: FN is used to display a Font Picker.

Command
yad --form --field="Font::FN"
yad form field FN 1
Figure 22. Font filed

When you click on the Font Button:

yad form field FN 2
Figure 23. Font selectiondialog
Tip 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.

Command
yad --form --field="Folder List:MFL" /home
yad form field MFL
Figure 24. Multiple File List dialog

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.

Command
yad --form --field="MDIR:MDIR" /home
yad form field MDIR1
Figure 25. Select folders field
yad form field MDIR2
Figure 26. Select folder dialog

1.1.15. DT - Date Picker

Field type: DT provides a Date Picker

Command
yad --form --field="Date::DT"
yad form field DT 1
Figure 27. Date filed

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

yad form field DT 2
Figure 28. Calendar dialog

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.

yad form field scale
Figure 29. Scalefiled

1.1.17. SW - Switch field

Initial value is a case insensitive boolean constant (TRUE or FALSE).

yad form field sw1
Figure 30. Switch not active
yad form field sw2
Figure 31. Switch active

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.

yad form icon
Figure 32. Icon field

1.1.19. CLR - Color Picker

Field type: CLR provides a colour Picker.

Command
yad --form --field="Color::CLR"
yad form field CLR 1
Figure 33. Color Picker field

You can set a default colour by adding the Hex code:

Command
yad --form --field="Color::CLR" "#F507D0"
yad form field CLR 2
Figure 34. Color Picker field with preset color

Click the Button to open the Colour Selector.

yad form field CLR 3
Figure 35. Color picker dialog

To make a selection you must click on the triangle and press enter.
Clicking on the wheel just moves the triangle.

Tip 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.

Command
yad --form --field="Button:BTN"
yad form field BTN
Figure 36. Button field

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.

Command
yad --form --field="Image Viewer:BTN" ristretto

1.1.21. FBTN - Button field

Same as button field, but with full relief of a button.

yad form field FBTN
Figure 37. Button field with relief

Field Type: LINK Link button field.

Command
yad --form --field="Google":link http://www.google.com
yad form field LINK
Figure 38. Link button field
yad form field LINK2
Figure 39. Link button field mouse hover

1.1.23. LBL - Text label

If field name is empty, horizontal separator line will be shown.

Tip Whatever you put inside the quotes before the colon becomes the Label.
Command
yad --form --field="This is a Label Maaate:LBL"
yad form field LBL
Figure 40. Label field

1.1.24. TXT Text entry

Multiline text entry. This field is always occupy all of form width.

Command
yad --form \
  --field="Text::TXT" "This is a Text box where you can display various information."
yad form field TXT
Figure 41. Text field

1.2. --align

--align=TYPE set alignment of filed labels (left, center or right).

Command
yad --form --align=right --field="Label Aligned Right":LBL
yad form align right
Figure 42. Text field aligned to right

Label aligned right. Left and Center is also possible.

1.3. --columns=NUMBER

Set number of columns in form.

Code
#!/bin/sh
yad --form \
  --columns=2 \
  --field="Firstname:" "Billy" \
  --field="Age:" "21" \
  --field="Lastname:" "Bloggs" \
  --field="Sex::"CB "Male!Female"
yad form columns
Figure 43. Form with two columns
Note 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.

yad form focus field
Figure 44. Example that focus field 2:
Code
#!/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.

Caution 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.

Code
#!/bin/sh
yad --form \
  --field="Firstname:" "Billy" \
  --field="Lastname:" "Bloggs"

When you run the above script in a terminal you get this:

yad form separator 1
Figure 45. Form with default separators

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.

Code
#!/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.

yad form separator 1
Figure 46. Form with space separators

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 !

Code
#!/bin/sh
yad --form \
  --field="Sex::"CB "Male!Female!Other"
yad form separator 2
Figure 47. Dialog for item separator example

Output: Male|

Now lets be bold and change both default separators, the --separator and --item-separator.

Code
#!/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:

Code
#!/bin/sh
yad --form \
  --separator=" " \
  --date-format="%-d %B %Y" \
  --field="Date:":DT
yad form date format
Figure 48. Date format example

Click on the little calendar, choose a date, click OK
Output: 4 July 2021

Here are some date and time format codes in alphabetical order
%% 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.

yad form scroll
Figure 49. Scrollable dialog
Code
#!/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

Example code (Make Wallpaper)
#!/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.

yad form example
Figure 50. Make Wallpaper example

Back to YAD Guide