Search code examples
zenity

dynamic yad lists possible?


I wonder if anyone more familiar with yad (yet another dialogue) knows if dynamic lists are possible and if so how might one be implemented using the contents of a bash array assigning FALSE to each list item?

I have a script that manages multiple LUKS partitions, and so when user selects to mount a partition they are presented with a list of partitions not yet mounted from which to make their next selection. So the upshot is that they cannot select a mount point already mounted.

This is currently managed by presenting the user the list in a terminal, but I would like to try using a yad list dialogue if dynamic lists are possible.

From the scant pages detailing yad usage online I could not find anything regarding dynamic lists, leading me to believe this is will quite likely not be possible.


Solution

  • Taken from zenity example here you could do:

    devsToMnt=$(for f in "${part_list_array[@]}" ; do echo FALSE ; echo "$f" ; done | yad --list --center --height="400" --checklist --column="Select" --column="Device to mount:" --print-column="2" --multiple --separator=" ")
    

    and whatever partitions the user chooses will be available in $devsToMnt