Skip to content

Zenity for WSL, Cygwin, MSYS2

Nuno Cruces edited this page May 5, 2022 · 1 revision

Windows Subsystems

Windows binaries can be used directly on WSL, Cygwin and MSYS2 (aka. Git for Windows shell).

The File Selection dialog, however, uses Windows file paths. To handle path conversion automatically, use the following suggested configurations.

Windows Subsystem for Linux setup

Recommended:

Install using Homebrew 🍺.

Alternative:

Download the Windows binary, zenity.exe, put it somewhere.
Then create the following script, name it zenity, make it executable, and place it on your Linux/WSL path:

#!/bin/sh
exec /mnt/c/path/to/zenity.exe --unixeol --wslpath "$@"

Cygwin, MSYS2 (aka. Git for Windows shell)

Recommended:

Install using Scoop 🍨.

Alternative:

Download the Windows binary, zenity.exe, put it somewhere.
Then create the following script, name it zenity, make it executable, and place it on your Cygwin/MSYS2 path:

#!/bin/sh
exec /cygdrive/c/path/to/zenity.exe --unixeol --cygpath "$@"

Using the Go package on WSL

Go apps on WSL are plain Linux binaries, which can't access the Win32 API.

To use this package on WSL, you need to first install zenity on WSL.
This installs a zenity.exe binary (with access to the Win32 API), and places a zenity wrapper script somewhere on your Linux/WSL path.

Then, the Linux version of the package will just work (as will any Linux binary/script that depends on zenity).