{"id":13413151,"url":"https://github.com/getlantern/systray","last_synced_at":"2025-10-15T21:45:21.994Z","repository":{"id":23162178,"uuid":"26517837","full_name":"getlantern/systray","owner":"getlantern","description":"a cross platfrom Go library to place an icon and menu in the notification area","archived":false,"fork":false,"pushed_at":"2024-07-03T04:41:06.000Z","size":55069,"stargazers_count":3439,"open_issues_count":108,"forks_count":480,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-04-09T02:13:42.794Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getlantern.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-12T03:41:57.000Z","updated_at":"2025-04-08T07:08:32.000Z","dependencies_parsed_at":"2024-09-21T03:00:46.201Z","dependency_job_id":"fe57cf67-20be-4052-8ebe-974abe14679d","html_url":"https://github.com/getlantern/systray","commit_stats":{"total_commits":150,"total_committers":32,"mean_commits":4.6875,"dds":0.7066666666666667,"last_synced_commit":"d57f43fe06ae79bce7ad747fe2d338e77839e9b5"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fsystray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fsystray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fsystray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fsystray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getlantern","download_url":"https://codeload.github.com/getlantern/systray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059521,"owners_count":22007771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:34.167Z","updated_at":"2025-10-15T21:45:16.965Z","avatar_url":"https://github.com/getlantern.png","language":"Go","readme":"# systray\n\nsystray is a cross-platform Go library to place an icon and menu in the notification area.\n\n## Features\n\n* Supported on Windows, macOS, and Linux\n* Menu items can be checked and/or disabled\n* Most functions may be called from any goroutine\n\n## API\n\n```go\nfunc main() {\n\tsystray.Run(onReady, onExit)\n}\n\nfunc onReady() {\n\tsystray.SetIcon(icon.Data)\n\tsystray.SetTitle(\"Awesome App\")\n\tsystray.SetTooltip(\"Pretty awesome超级棒\")\n\tmQuit := systray.AddMenuItem(\"Quit\", \"Quit the whole app\")\n\n\t// Sets the icon of a menu item. Only available on Mac and Windows.\n\tmQuit.SetIcon(icon.Data)\n}\n\nfunc onExit() {\n\t// clean up here\n}\n```\n\nSee [![full API](https://pkg.go.dev/badge/github.com/getlantern/systray.svg)](https://pkg.go.dev/github.com/getlantern/systray) as well as [CHANGELOG](https://github.com/getlantern/systray/tree/master/CHANGELOG.md).\n\nNote: this package requires cgo, so make sure you set `CGO_ENABLED=1` before building.\n\n## Try the example app!\n\nHave go v1.12+ or higher installed? Here's an example to get started on macOS:\n\n```sh\ngit clone https://github.com/getlantern/systray\ncd systray/example\nenv GO111MODULE=on go build\n./example\n```\n\nOn Windows, you should build like this:\n\n```\nenv GO111MODULE=on go build -ldflags \"-H=windowsgui\"\n```\n\nNow look for *Awesome App* in your menu bar!\n\n![Awesome App screenshot](example/screenshot.png)\n\n## The Webview example\n\nThe code under `webview_example` is to demostrate how it can co-exist with other UI elements. Note that the example doesn't work on macOS versions older than 10.15 Catalina.\n\n## Platform notes\n\n### Linux\n\n* Building apps requires gcc as well as the `gtk3` and `libayatana-appindicator3` development headers to be installed. For Debian or Ubuntu, you may install these using:\n\n```sh\nsudo apt-get install gcc libgtk-3-dev libayatana-appindicator3-dev\n```\n\nOn Linux Mint, `libxapp-dev` is also required.\n\nIf you need to support the older `libappindicator3` library instead, you can pass the build flag `legacy_appindicator`\nwhen building. For example:\n\n```\ngo build -tags=legacy_appindicator\n```\n\nTo build `webview_example`, you also need to install `libwebkit2gtk-4.0-dev` and remove `webview_example/rsrc.syso` which is required on Windows.\n\n### Windows\n\n* To avoid opening a console at application startup, use these compile flags:\n\n```sh\ngo build -ldflags -H=windowsgui\n```\n\n### macOS\n\nOn macOS, you will need to create an application bundle to wrap the binary; simply folders with the following minimal structure and assets:\n\n```\nSystrayApp.app/\n  Contents/\n    Info.plist\n    MacOS/\n      go-executable\n    Resources/\n      SystrayApp.icns\n```\n\nWhen running as an app bundle, you may want to add one or both of the following to your Info.plist:\n\n```xml\n\u003c!-- avoid having a blurry icon and text --\u003e\n\t\u003ckey\u003eNSHighResolutionCapable\u003c/key\u003e\n\t\u003cstring\u003eTrue\u003c/string\u003e\n\n\t\u003c!-- avoid showing the app on the Dock --\u003e\n\t\u003ckey\u003eLSUIElement\u003c/key\u003e\n\t\u003cstring\u003e1\u003c/string\u003e\n```\n\nConsult the [Official Apple Documentation here](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1).\n\nOn macOS, it's possible to set the underlying\n[`NSStatusItemBehavior`](https://developer.apple.com/documentation/appkit/nsstatusitembehavior?language=objc)\nwith `systray.SetRemovalAllowed(true)`. When enabled, the user can cmd-drag the\nicon off the menu bar.\n\n## Credits\n\n- https://github.com/xilp/systray\n- https://github.com/cratonica/trayhost\n","funding_links":[],"categories":["Go","HarmonyOS","开源类库","GUI","Open source library","Relational Databases","常用的GUI开发库","\u003cspan id=\"gui\"\u003eGUI\u003c/span\u003e"],"sub_categories":["Windows Manager","桌面开发","Advanced Console UIs","检索及分析资料库","Search and Analytic Databases","Desktop Development","高级控制台界面","交互工具","SQL 查询语句构建库","高級控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetlantern%2Fsystray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetlantern%2Fsystray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetlantern%2Fsystray/lists"}