aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/swaynag.h
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-02 21:37:29 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-03 10:37:35 -0400
commita7f7d4a488c8d3b2461122765f9904c8a411a583 (patch)
tree7abee51265a8b9550c62255d0c6649935ee1d6a2 /include/sway/swaynag.h
parentShow swaynag on config errors (diff)
downloadsway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.gz
sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.zst
sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.zip
Write to swaynag pipe fd directly on config errors
Diffstat (limited to 'include/sway/swaynag.h')
-rw-r--r--include/sway/swaynag.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/sway/swaynag.h b/include/sway/swaynag.h
new file mode 100644
index 00000000..ac0086a1
--- /dev/null
+++ b/include/sway/swaynag.h
@@ -0,0 +1,33 @@
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// Copy all fields of one instance to another
12void swaynag_clone(struct swaynag_instance *dest,
13 struct swaynag_instance *src);
14
15// Spawn swaynag. If swaynag->detailed, then swaynag->fd[1] will left open
16// so it can be written to. Call swaynag_show when done writing. This will
17// be automatically called by swaynag_log if the instance is not spawned and
18// swaynag->detailed is true.
19bool swaynag_spawn(const char *swaynag_command,
20 struct swaynag_instance *swaynag);
21
22// Kill the swaynag instance
23void swaynag_kill(struct swaynag_instance *swaynag);
24
25// Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed
26// is false.
27void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
28 const char *fmt, ...);
29
30// If swaynag->detailed, close swaynag->fd[1] so swaynag displays
31void swaynag_show(struct swaynag_instance *swaynag);
32
33#endif