1. Yad File Dialog
yad --file
1.1. --filename=FILENAME
The file selection options need to be prefixed by yad --file
EG:
yad --file --filename=/home/ingemar/hello.txt
The file /home/ingemar/hello.txt
must exist.
This will select /home/ingemar/hello.txt
1.2. --multiple
Allow multiple selection.
yad --file --multiple
Use the Ctrl or Shift keys when selecting.
It’s all well and good being able to bring up a file select dialog but it needs to be able to parse the information selected.
One way is to assign the file selection dialog to a variable like:
CHOOSEFILE=$(yad --file)
To see how it works try selecting a graphics file in a script like this:
#!/bin/sh
CHOOSEFILE=$(yad --file) \
ristretto $CHOOSEFILE
Make sure you make the script executable.
When you have choosen a fil in the dialok and klick on the OK button ristretto will star and show the selected picture.
1.3. --directory
Activate directory-only selection
yad --file --directory
Only directories will be selectable.
1.4. --save
Activate save mode.
yad --file --save
This provides a way to save a file.
If you type test.txt in the name field and click on OK the output will be:
/home/ingemar/test.txt
1.5. --separator=STRING
Specify separator character when returning multiple filenames.
Default separator is`|`.
yad --file --multiple --separator='\n'
/home/ingemar/Dokument/YAD/Yad-guide-12/Info/help-all.txt
/home/ingemar/Dokument/YAD/Yad-guide-12/Info/help-app.txt
/home/ingemar/Dokument/YAD/Yad-guide-12/Info/help-calendar.txt
1.6. --file-filter=NAME | PATTERN1 PATTERN2
Add a filename filter.
NAME
is a displayed filter name, PATTERN
is a shell-style filename pattern (for example *.txt). This option may be used multiple times.
yad --file --file-filter "Text files | *.txt *.text"
This will only show files with the file extensions txt and text.
1.7. --mime-filter=NAME | MIME1 MIME2 …
Add a mime-type filter.
NAME
is a displayed filter name, PATTERN
is a name of mime type (for example text/plain). This option may be used multiple times.
yad --file --mime-filter="HTML|text/html"
This will only show html files.
1.8. --image-filter=[NAME]
Add filter for images supported by gdk-pixbuf library.
NAME
in as optional name for this filter.
This will only show images.
yad --file --image-filter=png
1.9. --add-preview
Add preview widget.
Preview images loads from normal (default) or large thumbnails.
yad --file --add-preview
1.9.1. --large-preview
Use large previews by default.
This option can be permanently turned on through yad settings.
yad --file --add-preview --large-preview
YAD doesn’t check mtime for thumbnailed images and doesn’t updates preview if origial file was changed after thumbnail was created. |
1.10. --title=TEXT
Display a file selector with the title Select a file to remove
. The file selected is returned on standard output.
yad --file --title="Select a file to remove" --file-selection
/home/ingemar/printlist
1.11. --window-icon=ICON
Set the window icon.
yad --file --title="Select a file to remove" --file-selection --window-icon=gtk-delete