Search code examples
shzenity

Zenity --list --checklist issue


I'm trying to create a Zenity list to select kernel versions for removal.

So far I have:

dpkg -l | grep linux-image- | cut -f 3 -d ' ' | sed -e 's/^/FALSE /' | zenity --list --checklist --title="Select the Kernel versions to remove" --column="Kernel Version"

Most of this works in isolation, but I can't get the checkbox bits to work at all.

I just end up with a list of unchecked checkboxes and no corresponding items.


Solution

  • Finally figured it out, though I couldn't find it explained anywhere...

    You need to specify a column name for all columns INCLUDING the checkbox column.

    AND, there was no need to include the word FALSE at the start of every line as was implied by the Zenity help pages and examples I read.. strange.

    So:

    dpkg -l | grep linux-image- | cut -f 3 -d ' ' | zenity --list --checklist --title="Select the Kernel versions to remove" --column="Remove?" --column="Kernel Version"
    

    works perfectly now (other than a GLib-WARNING... Bad file descriptor (9) on my system which is another issue).