Improve README based on my installation experience

This commit is contained in:
Thomas Stromberg
2020-05-06 00:50:04 -07:00
committed by Joesis
parent 6c0d20dff5
commit ecaa4b94e2
2 changed files with 36 additions and 20 deletions
+36 -20
View File
@@ -1,7 +1,13 @@
Package systray is a cross platfrom Go library to place an icon and menu in the notification area.
Tested on Windows 8, Mac OSX, Ubuntu 14.10 and Debian 7.6.
systray is a cross-platform Go library to place an icon and menu in the notification area.
## Features
* Supported on Windows, macOS, and Linux
* Menu items can be checked and/or disabled
* Methods may be called from any Goroutine
## API
## Usage
```go
func main() {
// Should be called at the very beginning of main().
@@ -22,35 +28,45 @@ func onExit() {
// clean up here
}
```
Menu item can be checked and / or disabled. Methods except `Run()` can be invoked from any goroutine. See demo code under `example` folder.
## Platform specific concerns
## Try the example app!
Have go v1.12+ or higher installed? Here's an example to get started on macOS:
```sh
git clone https://github.com/getlantern/systray
env GO111MODULE=on go run systray/example/main.go
```
The following text will then appear on the console:
```sh
go: finding github.com/skratchdot/open-golang latest
go: finding github.com/getlantern/systray latest
go: finding github.com/getlantern/golog latest
```
Now look for *Awesome App* in your menu bar!
![Awesome App screenshot](example/screenshot.png)
## Platform notes
### Linux
* Building apps requires the `gtk3` and `libappindicator3` development headers to be installed. For Debian or Ubuntu, you can may install these using:
```sh
sudo apt-get install libgtk-3-dev libappindicator3-dev
```
Checked menu item not implemented on Linux yet.
## Try
* Checked menu items are not yet implemented
Under `example` folder.
Place tray icon under `icon`, and use `make_icon.bat` or `make_icon.sh`, whichever suit for your os, to convert the icon to byte array.
Your icon should be .ico file under Windows, whereas .ico, .jpg and .png is supported on other platform.
```sh
go get
go run main.go
```
## Building and the Console Window
By default, the binary created by `go build` will cause a console window to be opened on both Windows and macOS when run.
### Windows
To prevent launching a console window when running on Windows, add these command-line build flags:
* To avoid opening a console at application startup, use these compile flags:
```sh
go build -ldflags -H=windowsgui
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB