From 5f65f339896fadf0011b75d78c869594876d35d9 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sun, 28 Oct 2018 10:25:47 +0000 Subject: swaybar: add tray interface --- include/swaybar/bar.h | 8 ++++++++ include/swaybar/tray/tray.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 include/swaybar/tray/tray.h (limited to 'include/swaybar') diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 57c5114e..ef27012d 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h @@ -1,6 +1,7 @@ #ifndef _SWAYBAR_BAR_H #define _SWAYBAR_BAR_H #include +#include "config.h" #include "input.h" #include "pool-buffer.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h" @@ -8,6 +9,9 @@ struct swaybar_config; struct swaybar_output; +#if HAVE_TRAY +struct swaybar_tray; +#endif struct swaybar_workspace; struct loop; @@ -38,6 +42,10 @@ struct swaybar { int ipc_socketfd; struct wl_list outputs; // swaybar_output::link + +#if HAVE_TRAY + struct swaybar_tray *tray; +#endif }; struct swaybar_output { diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h new file mode 100644 index 00000000..217e2d45 --- /dev/null +++ b/include/swaybar/tray/tray.h @@ -0,0 +1,28 @@ +#ifndef _SWAYBAR_TRAY_TRAY_H +#define _SWAYBAR_TRAY_TRAY_H + +#include "config.h" +#ifdef HAVE_SYSTEMD +#include +#elif HAVE_ELOGIND +#include +#endif +#include +#include + +struct swaybar; +struct swaybar_output; + +struct swaybar_tray { + struct swaybar *bar; + + int fd; + sd_bus *bus; +}; + +struct swaybar_tray *create_tray(struct swaybar *bar); +void destroy_tray(struct swaybar_tray *tray); +void tray_in(int fd, short mask, void *data); +uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x); + +#endif -- cgit v1.2.3