diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-10-28 10:25:47 +0000 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-12-31 20:40:18 +0000 |
commit | 5f65f339896fadf0011b75d78c869594876d35d9 (patch) | |
tree | bbb234ad123657f1a8ed1f311cf9183b67e7e961 /include/swaybar | |
parent | swaybar: remove old tray implementation (diff) | |
download | sway-5f65f339896fadf0011b75d78c869594876d35d9.tar.gz sway-5f65f339896fadf0011b75d78c869594876d35d9.tar.zst sway-5f65f339896fadf0011b75d78c869594876d35d9.zip |
swaybar: add tray interface
Diffstat (limited to 'include/swaybar')
-rw-r--r-- | include/swaybar/bar.h | 8 | ||||
-rw-r--r-- | include/swaybar/tray/tray.h | 28 |
2 files changed, 36 insertions, 0 deletions
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 @@ | |||
1 | #ifndef _SWAYBAR_BAR_H | 1 | #ifndef _SWAYBAR_BAR_H |
2 | #define _SWAYBAR_BAR_H | 2 | #define _SWAYBAR_BAR_H |
3 | #include <wayland-client.h> | 3 | #include <wayland-client.h> |
4 | #include "config.h" | ||
4 | #include "input.h" | 5 | #include "input.h" |
5 | #include "pool-buffer.h" | 6 | #include "pool-buffer.h" |
6 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 7 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
@@ -8,6 +9,9 @@ | |||
8 | 9 | ||
9 | struct swaybar_config; | 10 | struct swaybar_config; |
10 | struct swaybar_output; | 11 | struct swaybar_output; |
12 | #if HAVE_TRAY | ||
13 | struct swaybar_tray; | ||
14 | #endif | ||
11 | struct swaybar_workspace; | 15 | struct swaybar_workspace; |
12 | struct loop; | 16 | struct loop; |
13 | 17 | ||
@@ -38,6 +42,10 @@ struct swaybar { | |||
38 | int ipc_socketfd; | 42 | int ipc_socketfd; |
39 | 43 | ||
40 | struct wl_list outputs; // swaybar_output::link | 44 | struct wl_list outputs; // swaybar_output::link |
45 | |||
46 | #if HAVE_TRAY | ||
47 | struct swaybar_tray *tray; | ||
48 | #endif | ||
41 | }; | 49 | }; |
42 | 50 | ||
43 | struct swaybar_output { | 51 | 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 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_TRAY_H | ||
2 | #define _SWAYBAR_TRAY_TRAY_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #ifdef HAVE_SYSTEMD | ||
6 | #include <systemd/sd-bus.h> | ||
7 | #elif HAVE_ELOGIND | ||
8 | #include <elogind/sd-bus.h> | ||
9 | #endif | ||
10 | #include <cairo.h> | ||
11 | #include <stdint.h> | ||
12 | |||
13 | struct swaybar; | ||
14 | struct swaybar_output; | ||
15 | |||
16 | struct swaybar_tray { | ||
17 | struct swaybar *bar; | ||
18 | |||
19 | int fd; | ||
20 | sd_bus *bus; | ||
21 | }; | ||
22 | |||
23 | struct swaybar_tray *create_tray(struct swaybar *bar); | ||
24 | void destroy_tray(struct swaybar_tray *tray); | ||
25 | void tray_in(int fd, short mask, void *data); | ||
26 | uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x); | ||
27 | |||
28 | #endif | ||