But It would need two functions to select the directory and the mask to use.
It may already have been done and no one has shown an example using the fileselect widget. When I get the functions competed, I may share it.
Code: Select all
#! /bin/sh
#This is how far I got creating a masked file list.
# If one adds an entry box to select the directory and another to select the mask with variables, they can be
#passed to a function that writes a masked selection to /tmp/myfiles.txt
#This is only a start, and with a file mask widget, one would not have to jump through hoops to display
# a masked file list.
GTKDIALOG=gtkdialog
cd /root/examples #select the directory
ls t* >/tmp/myfiles.txt #pick mask to use with ls
window_width=300
icon_names=(echo $(</tmp/myfiles.txt))
lstCreate() {
echo '<list>'
for ((y = 0; y < 15; y++)); do
i=$((x*15*2+y*2+1))
echo '<item>"'${icon_names[$i]}'"</item>'
done
echo '</list>'
}
export lstCreate
export MAIN_DIALOG='
<window title="File MASK Test" width-request="'$window_width'"
border-width="0" resizable="false">
<hbox>
'"$(lstCreate)"'
</hbox>
</window>
'
gtkdialog3 -p MAIN_DIALOG