Is it possible to have a Zenity list-style menu show a code option like -r?

I am trying to make a simple GUI for an FFMPEG bash script. This is just one prompt for selecting a framerate for a video. I wanted one of the Zenity list columns to show the actual FFMPEG option that would be used, it would be for returning to be used in the FFMPEG code, but also to hopefully teach some FFMPEG syntax to the user. Like this:


zenity --list \
    --title="Select framerate" \
    --column="ffmpeg code" --column="Framerate" --column="Description" \
    "-r 24000/1001" "23.976fps" "NTSC compatible 24fps" \
    "-r 30000/1001" "29.98fps" "NTSC compatible 30fps"

But this gives the Zenity error message:

This option is not available. Please see --help for all possible usages.

I think I understand what the problem is; Zenity thinks the -r is a Zenity option, and doesn't recognize it.

Just removing the - before the -r fixes it:

zenity --list \
    --title="Select framerate" \
    --column="ffmpeg code" --column="Framerate" --column="Description" \
    "r 24000/1001" "23.976fps" "NTSC compatible 24fps" \
    "r 30000/1001" "29.98fps" "NTSC compatible 30fps"

Shows no error and correctly displays:

A Zenity GUI with the aforementioned options, but no dash in front of the "r" as in "-r"

But then of course this would not teach anyone how to use the FFMPEG framerate option because the dash is needed.

Escaping the dash with a backslash like \- just prints the backslash too, which would also not teach anyone FFMPEG:

A Zenity GUI with the aforementioned options with "-r" in front of them.

I've also tried using ' and """ and ''' instead of the double quotes, but they give the same This option is not available... error message.

Is it just not possible to get Zenity to display something like that? I know there are ways around the problem if I just want the list to return the code ( just appending -r on beginning of the output) but as I said I'd like to be able to teach the user of the GUI a little about using the FFMPEG command line interface. Any ideas? Thank you.

Edit: By the way zenity --version on my system (Xubuntu 14.04) returns 3.8.0 if the version could be part of the problem.


You can just put the space before the - character, like this:

zenity --list \
    --title="Select framerate" \
    --column="ffmpeg code" --column="Framerate" --column="Description" \
    " -r 24000/1001" "23.976fps" "NTSC compatible 24fps" \
    " -r 30000/1001" "29.98fps" "NTSC compatible 30fps"
  • Not sure where you got it, but it works :) – Jacob Vlijm Feb 2 '16 at 20:47
  • Oh for the love of... it's pretty sad that I NEVER would have thought of that! Thank you so much incBrain! – InverseTelecine Feb 2 '16 at 20:56

Write your data one line per cell into stdin, like

zenity --list \
  --title="Select framerate" \
  --column="ffmpeg code" --column="Framerate" --column="Description" <<EOF
-r 24000/1001
NTSC compatible 24fps
-r 30000/1001 
NTSC compatible 30fps
  • Thank you for this Florian! incBrain's solution solved my problem, but I'm definitely saving your solution. It seems like a good worst-case-scenerio solution for other situations without such simple answers. – InverseTelecine Feb 2 '16 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.