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).

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

notes:
- 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

Enjoy!

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

Edit:
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)

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

16 comments:

  1. 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

    ReplyDelete
    Replies
    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

      Delete
    2. Thanks for quick reply.
      Before I used zenity from here:
      http://www.placella.com/software/zenity/
      with
      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?

      Delete
    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...

      Delete
  2. 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!

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

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

      Delete
  3. Hi,

    Trying to compile zenity with moluccas but can't find any documentation (actually trying zenity static build and then yad in order to have a single executable yad.exe in windows).
    Is there any doc for installing gtk and others in moluccas ?

    Thanks.

    ReplyDelete
    Replies
    1. if yad is your goal, you need to port yad's fork() and some other posix function. if static is also your goal better stick with gtk 3.6.x (the aliasing issue above can be fixed easily). the easiest way to get gtk is msys2 but static build is different story...

      Delete
    2. Thank you for your reply.
      Before being able to build yad, I want to make zenity builds work.
      Do you have any directions with Moluccass ? (Or msys2) ? Maybe an old build instructions file ?
      Thanks.

      Delete
    3. I have
      https://github.com/tumagonx/pygi-mingw-patches
      see gnomebuild.sh file (this for moluccas), but I think it's overkill for zenity, with msys2 you use pacman to install gtk3+devel packages then build zenity yourself

      Delete
  4. There's a new link to DOWNLOAD:
    https://github.com/maravento/winzenity/raw/master/zenity.zip

    Webpage:
    Zenity Portable for Windows
    https://github.com/maravento/winzenity

    ReplyDelete
  5. new repo https://github.com/maravento/vault/tree/master/winzenity

    ReplyDelete