Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some linux support #21

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[linux] add libnotify binding
  • Loading branch information
yapus committed Oct 14, 2019
commit 86a0290155edba2481f349c38eb11eb3fdf420ba
9 changes: 9 additions & 0 deletions platform/linux/tray.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <string.h>
#include <libappindicator/app-indicator.h>
#include <libnotify/notify.h>

static const char *icon = NULL;
static size_t iconSize = 0;
Expand All @@ -29,6 +30,14 @@ void _tray_callback(GtkMenuItem *item, gpointer user_data)
// TODO: Implement.
void display_notification(int id, const char* title, const char* body, struct image imageData, double duration)
{
char app_name[32];
snprintf(app_name, sizeof(app_name), "%08x", id);
notify_init(app_name);
NotifyNotification* n = notify_notification_new (title,
body,
0);
notify_notification_set_timeout(n, (int)(1000*duration)); // milliseconds
notify_notification_show(n, 0);
}

// TODO: Implement.
Expand Down
2 changes: 1 addition & 1 deletion trayhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
#cgo darwin CFLAGS: -DDARWIN -x objective-c
#cgo darwin LDFLAGS: -framework Cocoa

#cgo linux pkg-config: gtk+-3.0 appindicator3-0.1
#cgo linux pkg-config: gtk+-3.0 appindicator3-0.1 libnotify
#cgo linux CFLAGS: -DLINUX
#cgo linux LDFLAGS: -ldl

Expand Down