I have the following twenty-six files in a folder:
$ ls
a.txt c.txt e.txt g.txt i.txt k.txt m.txt o.txt q.txt s.txt u.txt w.txt y.txt
b.txt d.txt f.txt h.txt j.txt l.txt n.txt p.txt r.txt t.txt v.txt x.txt z.txt
$I can use Zenity like this:
zenity --list --title=Test --width=275 --height=400 --column="File names" *.txtand get this interface initially:
If I want to select a file lower down the list, say, r.txt, I press r and r.txt is selected.
However, if I use Yad instead of Zenity like this:
yad --list --title=Test --width=275 --height=400 --column="File names" *.txtpressing r does nothing. I have to use the arrow keys to scroll through the list until I come to r.txt.
My understanding is that Yad has more features than Zenity. So is there some way to get Yad to do what Zenity does?
(Tested using the repository versions of Yad and Zenity found in 18.04 and 19.10.)
51 Answer
For learning yad I found this great reference: YAD - Smokey01.com
As mentioned in comments you want to use the option --search-column=N
Take the following code snippet as an example:
while true ; do local Selected INSTRUCTIONS INSTRUCTIONS="Click Icon to move and press Enter" Selected=$(yad --list --radiolist \ --image="$ICON" --window-icon="$ICON" \ --margins=10 --no-click --search-column=4 \ --title="$TITLE" "${GEOMETRY[@]}" \ --text="<big><b>$TEXT</b></big> - $INSTRUCTIONS" \ --column "Select" \ --column "Order" \ --column "Icon Type:HD" \ --column "Icon name" \ --column "Linkless name:HD" \ --column "Modified date" \ --column "Col Pos:NUM" \ --column "Row Pos:NUM" \ --button="_Alpha Sort:$ButnAlpha" \ --button="_Linkless Sort:$ButnLinkless" \ --button="_Oldest Date:$ButnOldest" \ --button="_Newest Date:$ButnNewest" \ --button="_Test:$ButnTest" \ --button="_Apply:$ButnApply" \ --button="_Cancel:$ButnCancel" \ "${IconsArr[@]}") Retn="$?"Columns #3 and #5 are hidden but they are still counted. We want to search on Icon Name so it is column #4 as recorded here:
--margins=10 --no-click --search-column=4 \The short .gif clip below shows what happens when we type:
- a, Backspace, b, Backspace, c, Backspace, e (then gif loops)