diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-08-04 10:15:29 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-04 10:15:29 +1000 |
commit | e24fc3df18182f3b78cdf90322b0acabfb82a60e (patch) | |
tree | 27a696a801539c946ac597e20b920c4b29697204 /include/sway/swaynag.h | |
parent | ad2a7c26180dcb1ab0d2d128e207921152762ed6 (diff) | |
parent | 38675eba7be471a2dacb5928f54d046297c23517 (diff) | |
download | sway-e24fc3df18182f3b78cdf90322b0acabfb82a60e.tar.xz |
Merge branch 'master' into fix-2416
Diffstat (limited to 'include/sway/swaynag.h')
-rw-r--r-- | include/sway/swaynag.h | 29 |
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 @@ +#ifndef _SWAY_SWAYNAG_H +#define _SWAY_SWAYNAG_H + +struct swaynag_instance { + const char *args; + pid_t pid; + int fd[2]; + bool detailed; +}; + +// Spawn swaynag. If swaynag->detailed, then swaynag->fd[1] will left open +// so it can be written to. Call swaynag_show when done writing. This will +// be automatically called by swaynag_log if the instance is not spawned and +// swaynag->detailed is true. +bool swaynag_spawn(const char *swaynag_command, + struct swaynag_instance *swaynag); + +// Kill the swaynag instance +void swaynag_kill(struct swaynag_instance *swaynag); + +// Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed +// is false. +void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, + const char *fmt, ...); + +// If swaynag->detailed, close swaynag->fd[1] so swaynag displays +void swaynag_show(struct swaynag_instance *swaynag); + +#endif |