27 February 2013

Zenity 3.6.0 Portable

In Windows we can use WSH to interact with console/batch processing task, or for simple case "net send" or "msg" will suffice. Then I found zenity, a modern version of cdialog which curses based.

This tool use GTK as its gui to bridge console I/O with modern dialog window for many purpose. Its template (glade ui) can be customized too. I found it a good match for bash though I haven't try it with batch cmd (I dont see a reason why it won't work).

Here a slightly modified build (make it more Windows way as usual).

modified src: http://osspack32.googlecode.com/files/zenity-3.6.0_src.7z

- consequently as this is static build, no locales/translation included (English only), but it's possible to add
- zenity.ui  is embedded in the executable, to override it put zenity.ui alongside zenity.exe (see source for zenity.ui file)
- icons are different from original version as I force it to be stocked


Guide/examples are here http://help.gnome.org/users/zenity/stable/index.html.en

Hmm I think, I have an example...
"runas" which allow to do "UAC" ala commandline usually assume you know the username of the admin account (as it don't ask you), making it uninteractive. With zenity we could do something like this:

for /f "usebackq" %s in (`zenity --entry --text="This operation need admin account, please enter username:" --hide-text`) do runas /env /noprofile /user:%s "notepad \"D:\dokumen\rahasia.txt\""
Assuming zenity.exe is avaliable in "PATH" such as C:\Windows, above example will popup for username albeit we will then need to type password from runas console, ha ha (for security reason I guess)

It turned out to be pointless to make it static build, it still need schema file and icon db for displaying file dialog :( sorry


  1. Great.
    Thank you.

  2. Thanks for making a port of Zenity to Windows with newer version.
    2 issues I have seen so far:
    1. Fonts are very blur.
    2. When I try to resize one category name: (zenity.exe:3760): Gdk-CRITICAL **: gdk_device_get_source: assertion `GDK_IS_DEVICE (device)' failed

    1. Thanks for the remark,

      1. I think you can make setting file to customize gtk font and appearance, but then it won't be single exe :P
      2. This probably GTK3 bugs, have seen this before too

    2. Thanks for quick reply.
      Before I used zenity from here:
      SET ZENITY_DATADIR=C:\zenity\share\
      Do you have a build as not single executable file or can I compile it as not single executable?
      For the GTK error, is there an option that I can hide the specific error instead of all errors?

    3. No need to set environment and no need to rebuild, I just saying if you add another file then it doesn't count as single standalone exe :). Doesn't mean you have to recompile. All settings can be placed relative to where the exe reside. Simple ;)

      the setting files if I recall are
      fontconfig -> etc\fonts\fonts.conf (set anti aliasing text, etc)
      gtk3 -> etc\gtk-3.0\settings.ini (set default font to be used)
      zenity' UI -> zenity.ui
      if you want localization -> share\locale\...

      All folders and files above to be put relative to where zenity.exe located. See patched source for details, it's quite generic one.

      Don't know if the bug already reported, basically I build this to evaluate how stable GTK-3 for windows. Which apparently not quite yet...

  3. Do you plan to continue the project in the future? That's because I would like to know if I can use zenity for a cross-platform project. Incidentally, your porting works perfectly in a xubuntu Linux box with wine.
    Thank you!

    1. I'm not sure, at least if I can make it static build again with newer version...

    2. Thank you! It's a great work: such a lightweight tool, and so efficient!