mirror of
https://github.com/netbirdio/systray.git
synced 2026-05-22 17:08:41 -07:00
Support libayatana-appindicator on Linux
This changes the default behavior to use libayatana-appindicator
instead of libappindicator. If you need to link to the older
libappindicator library, use the build tag "legacy_appindicator":
go build -tags=legacy_appindicator
Closes #225, #224, and #191.
This commit is contained in:
@@ -70,13 +70,20 @@ The code under `webview_example` is to demostrate how it can co-exist with other
|
||||
|
||||
### Linux
|
||||
|
||||
* Building apps requires gcc as well as the `gtk3` and `libappindicator3` development headers to be installed. For Debian or Ubuntu, you may install these using:
|
||||
* 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:
|
||||
|
||||
```sh
|
||||
sudo apt-get install gcc libgtk-3-dev libappindicator3-dev
|
||||
sudo apt-get install gcc libgtk-3-dev libayatana-appindicator3-dev
|
||||
```
|
||||
|
||||
On Linux Mint, `libxapp-dev` is also required .
|
||||
On Linux Mint, `libxapp-dev` is also required.
|
||||
|
||||
If you need to support the older `libappindicator3` library instead, you can pass the build flag `legacy_appindicator`
|
||||
when building. For example:
|
||||
|
||||
```
|
||||
go build -tags=legacy_appindicator`
|
||||
```
|
||||
|
||||
To build `webview_example`, you also need to install `libwebkit2gtk-4.0-dev` and remove `webview_example/rsrc.syso` which is required on Windows.
|
||||
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef USE_LEGACY_APPINDICATOR
|
||||
#include <libappindicator/app-indicator.h>
|
||||
#else
|
||||
#include <libayatana-appindicator/app-indicator.h>
|
||||
#endif
|
||||
|
||||
#include "systray.h"
|
||||
|
||||
static AppIndicator *global_app_indicator;
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package systray
|
||||
|
||||
/*
|
||||
#cgo darwin CFLAGS: -DDARWIN -x objective-c -fobjc-arc
|
||||
#cgo darwin LDFLAGS: -framework Cocoa -framework WebKit
|
||||
|
||||
#include "systray.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// SetTemplateIcon sets the systray icon as a template icon (on macOS), falling back
|
||||
// to a regular icon on other platforms.
|
||||
// templateIconBytes and iconBytes should be the content of .ico for windows and
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//go:build linux && legacy_appindicator
|
||||
|
||||
package systray
|
||||
|
||||
/*
|
||||
#cgo linux pkg-config: appindicator3-0.1
|
||||
#cgo linux CFLAGS: -DUSE_LEGACY_APPINDICATOR
|
||||
|
||||
#include "systray.h"
|
||||
*/
|
||||
import "C"
|
||||
@@ -0,0 +1,10 @@
|
||||
//go:build linux && !legacy_appindicator
|
||||
|
||||
package systray
|
||||
|
||||
/*
|
||||
#cgo linux pkg-config: ayatana-appindicator3-0.1
|
||||
|
||||
#include "systray.h"
|
||||
*/
|
||||
import "C"
|
||||
Reference in New Issue
Block a user