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.


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" &
| improve this answer | |
(sleep 1 && DISPLAY=:0 wmctrl -F -a "Information" -b add,above) & (DISPLAY=:0 zenity --info --title="On Top" --text="Zenity's on top.")

Naturally, both zenity and wmctrl need to be installed. The two DISPLAY=:0 portions are probably necessary if you run the script as a cron job because cron's environment is not aware of your X display, dbus or desktop.

| improve this answer | |

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.