zenity/README.md

92 lines
4 KiB
Markdown
Raw Normal View History

2020-01-09 08:26:58 -05:00
# Zenity dialogs for Golang, Windows and macOS
2021-07-12 09:15:07 -04:00
[![Go Reference](https://pkg.go.dev/badge/image)](https://pkg.go.dev/github.com/ncruces/zenity)
2020-01-29 11:55:51 -05:00
[![Go Report](https://goreportcard.com/badge/github.com/ncruces/zenity)](https://goreportcard.com/report/github.com/ncruces/zenity)
2023-01-27 10:26:12 -05:00
[![Go Coverage](https://github.com/ncruces/zenity/wiki/coverage.svg)](https://raw.githack.com/wiki/ncruces/zenity/coverage.html)
2021-07-23 07:17:43 -04:00
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
2020-01-09 08:26:58 -05:00
2022-06-23 10:19:00 -04:00
This repo includes:
- a cross-platform [Go](https://go.dev/) package providing
2020-01-26 11:04:49 -05:00
[Zenity](https://help.gnome.org/users/zenity/stable/)-like dialogs
2022-06-23 10:19:00 -04:00
(simple dialogs that interact graphically with the user)
- a *“port”* of the `zenity` command to both Windows and macOS based on that library.
2020-01-09 08:26:58 -05:00
2021-04-09 10:14:31 -04:00
Implemented dialogs:
2020-01-13 21:26:25 -05:00
* [message](https://github.com/ncruces/zenity/wiki/Message-dialog) (error, info, question, warning)
2021-05-04 08:01:04 -04:00
* [text entry](https://github.com/ncruces/zenity/wiki/Text-entry-dialog)
2021-04-11 22:59:08 -04:00
* [list](https://github.com/ncruces/zenity/wiki/List-dialog) (simple)
2021-04-05 18:19:02 -04:00
* [password](https://github.com/ncruces/zenity/wiki/Password-dialog)
2021-04-30 14:19:14 -04:00
* [file selection](https://github.com/ncruces/zenity/wiki/File-selection-dialog)
* [color selection](https://github.com/ncruces/zenity/wiki/Color-selection-dialog)
2022-04-05 08:01:45 -04:00
* [calendar](https://github.com/ncruces/zenity/wiki/Calendar-dialog)
2021-04-30 14:19:14 -04:00
* [progress](https://github.com/ncruces/zenity/wiki/Progress-dialog)
2020-01-27 10:42:43 -05:00
* [notification](https://github.com/ncruces/zenity/wiki/Notification)
2020-01-09 08:26:58 -05:00
2020-01-15 10:06:42 -05:00
Behavior on Windows, macOS and other Unixes might differ slightly.
2020-01-09 08:26:58 -05:00
Some of that is intended (reflecting platform differences),
2021-04-27 20:27:28 -04:00
other bits are unfortunate limitations.
2020-01-09 08:26:58 -05:00
2021-06-07 08:54:18 -04:00
## Installing
The Go package:
2022-07-10 17:55:39 -04:00
go get github.com/ncruces/zenity@latest
2021-06-07 08:54:18 -04:00
2022-05-05 10:49:23 -04:00
The `zenity` command on macOS/WSL using [Homebrew](https://brew.sh/) 🍺:
2021-06-07 08:54:18 -04:00
brew install ncruces/tap/zenity
2022-05-05 10:49:23 -04:00
The `zenity` command on Windows using [Scoop](https://scoop.sh/) 🍨:
2022-05-04 18:22:19 -04:00
scoop install https://ncruces.github.io/scoop/zenity.json
2022-06-23 10:19:00 -04:00
The `zenity` command on macOS/Windows, if you have [Go](https://go.dev/):
2022-04-05 08:01:45 -04:00
go install github.com/ncruces/zenity/cmd/zenity@latest
2021-06-07 08:54:18 -04:00
Or download the [latest release](https://github.com/ncruces/zenity/releases/latest).
2022-06-23 10:19:00 -04:00
## Using
For the Go package, consult the [documentation](https://pkg.go.dev/github.com/ncruces/zenity#section-documentation)
and [examples](https://pkg.go.dev/github.com/ncruces/zenity#pkg-examples).
2020-01-09 08:26:58 -05:00
2022-06-23 10:19:00 -04:00
The `zenity` command does its best to be compatible with the GNOME version.\
Consult the [documentation](https://help.gnome.org/users/zenity/stable/)
and [man page](https://linux.die.net/man/1/zenity) of that command.
## Why?
2020-01-09 08:26:58 -05:00
2022-06-23 10:19:00 -04:00
#### Benefits of the Go package:
2020-01-09 08:26:58 -05:00
* no `cgo` (see [benefits](https://dave.cheney.net/2016/01/18/cgo-is-not-go), mostly cross-compilation)
2020-01-30 21:45:44 -05:00
* no main loop (or any other threading or initialization requirements)
* cancelation through [`context`](https://golang.org/pkg/context/)
2020-01-09 08:26:58 -05:00
* on Windows:
2020-01-09 13:37:03 -05:00
* no additional dependencies
* Explorer shell not required
* works in Server Core
2020-01-09 08:26:58 -05:00
* Unicode support
2021-04-27 20:27:28 -04:00
* High DPI (no manifest required)
* Visual Styles (no manifest required)
2020-01-17 09:23:34 -05:00
* WSL/Cygwin/MSYS2 [support](https://github.com/ncruces/zenity/wiki/Zenity-for-WSL,-Cygwin,-MSYS2)
2020-01-09 08:26:58 -05:00
* on macOS:
2020-01-19 06:57:05 -05:00
* only dependency is `osascript`
2020-01-15 10:06:42 -05:00
* on other Unixes:
2022-12-20 07:44:46 -05:00
* wraps either one of `zenity`, `matedialog`, [`qarma`](https://github.com/luebking/qarma)
2022-07-10 17:55:39 -04:00
2024-04-07 04:43:45 -04:00
## Zenity wrappers
Zenity wrappers for languages other than Go can benefit from the `zenity` command. On Unix (Linux, FreeBSD, etc) they can use the original tool, and on Windows/macOS they may use the command from this repo for portability.
Examples:
- NodeJS [`dialog-gui`](https://github.com/SnurfDev/dialog-gui) by [@SnurfDev](https://github.com/SnurfDev/dialog-gui)
- Crystal [`zenity.cr`](https://github.com/kojix2/zenity.cr) by [@kojix2](https://github.com/kojix2/)
2022-07-10 17:55:39 -04:00
## Credits
I'd like to thank all [contributors](https://github.com/ncruces/zenity/graphs/contributors),
but [@gen2brain](https://github.com/gen2brain) in particular
for [`dlgs`](https://github.com/gen2brain/dlgs),
which was instrumental to the Windows port of `zenity`.