Ubuntu – zenity window on top

zenity

I would like the window produced by zenity to be configured so it is always on top. There does not appear to be an option to enable this. Can someone suggest a source change to the zenity code so that I can get this to work? I want to be able to do
zenity –ontop "warning"

If there is an alternative which does not involve writing code, I would be interested in this too.

Best Answer

Something like this will keep a zenity Information dialog on top.
You can possibly adapt it to your particular needs.
I'm not sure why it needs the sleep, but is doesn't work without it.

sleep .1 && wmctrl -a Information -b add,above &
WINDOWID=$(xwininfo -root -int | awk '/xwininfo:/{print $4}') \
  zenity --info --text="This --info class dialog is on top of the root window" &