I have a problem with zenity I cannot work out. Could you guys help me?
I have a 7 line long tmp3 file:
AAA
BBB
...
FFF
GGG
I want to send this file through zenity so that it displays a checklist with the possibilty to check every line I want with every combination I want.
I previously wrote:
cat tmp3 | zenity --list \
--column='#' \
--text "Select playlist from the list below" \
--title "Please select one or more playlists" \
--multiple \
--width=300 \
--height=300 \
--checklist \
--column "Select" \
--separator="/ ")
All this does is create one single line in zenity with all 7 files of tmp3. Thats not what I want.
I currently wrote this:
choice=$(zenity --list \
--column "Playlists" FALSE $(cat tmp3) \
--text "Select playlist from the list below" \
--title "Please select one or more playlists" \
--multiple \
--width=300 \
--height=300 \
--checklist \
--column "Select" \
--separator="/ ")
Here something really weird happens that I dont understand. 4 out of 7 fields are created in zenity: AAA CCC EEE and GGG. But not the other ones. When I set -x for debugging I can see all 7 lines being piped to zenity... What is happening?????
I tried another solution by listing the 7 subfolders in my current folder (which happen to have the exact same name as the lines in tmp3). The same thing happens!:
I wrote this:
choice=$(zenity --list \
--column "Playlists" FALSE $(ls -d -1 */) \
--text "Select playlist from the list below" \
--title "Please select one or more playlists" \
--multiple \
--width=300 \
--height=300 \
--checklist \
--column "Select" \
--separator="/ ")
The second solution seems easier but my skills aren't very high. And I would like to understand the latter solution and why it does this.
Thank you guys!
EDIT: I have found this and tried to make it work my way but no success so far... http://www.linuxquestions.org/questions/programming-9/reading-lines-to-an-array-and-generate-dynamic-zenity-list-881421/
The part FALSE $(cat tmp3)
expands to
FALSE AAA
BBB
CCC
DDD
EEE
FFF
GGG
What you need is
FALSE AAA
FALSE BBB
FALSE CCC
FALSE DDD
FALSE EEE
FALSE FFF
FALSE GGG
One way to achieve this is --column "Playlists" $(sed s/^/FALSE\ / tmp3) \