summaryrefslogtreecommitdiffstats
path: root/include/sway/swaynag.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/swaynag.h')
-rw-r--r--include/sway/swaynag.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/sway/swaynag.h b/include/sway/swaynag.h
new file mode 100644
index 00000000..5a178739
--- /dev/null
+++ b/include/sway/swaynag.h
@@ -0,0 +1,29 @@
1#ifndef _SWAY_SWAYNAG_H
2#define _SWAY_SWAYNAG_H
3
4struct swaynag_instance {
5 const char *args;
6 pid_t pid;
7 int fd[2];
8 bool detailed;
9};
10
11// Spawn swaynag. If swaynag->detailed, then swaynag->fd[1] will left open
12// so it can be written to. Call swaynag_show when done writing. This will
13// be automatically called by swaynag_log if the instance is not spawned and
14// swaynag->detailed is true.
15bool swaynag_spawn(const char *swaynag_command,
16 struct swaynag_instance *swaynag);
17
18// Kill the swaynag instance
19void swaynag_kill(struct swaynag_instance *swaynag);
20
21// Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed
22// is false.
23void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
24 const char *fmt, ...);
25
26// If swaynag->detailed, close swaynag->fd[1] so swaynag displays
27void swaynag_show(struct swaynag_instance *swaynag);
28
29#endif