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 | |
parent | ad2a7c26180dcb1ab0d2d128e207921152762ed6 (diff) | |
parent | 38675eba7be471a2dacb5928f54d046297c23517 (diff) |
Merge branch 'master' into fix-2416
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/commands.h | 1 | ||||
-rw-r--r-- | include/sway/config.h | 12 | ||||
-rw-r--r-- | include/sway/swaynag.h | 29 |
3 files changed, 39 insertions, 3 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 41858ccc..f83907b2 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -150,6 +150,7 @@ sway_cmd cmd_splitt; sway_cmd cmd_splitv; sway_cmd cmd_sticky; sway_cmd cmd_swaybg_command; +sway_cmd cmd_swaynag_command; sway_cmd cmd_swap; sway_cmd cmd_title_format; sway_cmd cmd_unmark; diff --git a/include/sway/config.h b/include/sway/config.h index 909b6827..632aca14 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -7,6 +7,7 @@ #include <wlr/types/wlr_box.h> #include <xkbcommon/xkbcommon.h> #include "list.h" +#include "swaynag.h" #include "tree/layout.h" #include "tree/container.h" #include "wlr-layer-shell-unstable-v1-protocol.h" @@ -308,6 +309,8 @@ enum focus_wrapping_mode { * The configuration struct. The result of loading a config file. */ struct sway_config { + char *swaynag_command; + struct swaynag_instance swaynag_config_errors; list_t *symbols; list_t *modes; list_t *bars; @@ -345,6 +348,7 @@ struct sway_config { bool failed; bool reloading; bool reading; + bool validating; bool auto_back_and_forth; bool show_marks; @@ -403,17 +407,19 @@ struct sway_config { * Loads the main config from the given path. is_active should be true when * reloading the config. */ -bool load_main_config(const char *path, bool is_active); +bool load_main_config(const char *path, bool is_active, bool validating); /** * Loads an included config. Can only be used after load_main_config. */ -bool load_include_configs(const char *path, struct sway_config *config); +bool load_include_configs(const char *path, struct sway_config *config, + struct swaynag_instance *swaynag); /** * Reads the config from the given FILE. */ -bool read_config(FILE *file, struct sway_config *config); +bool read_config(FILE *file, struct sway_config *config, + struct swaynag_instance *swaynag); /** * Free config struct 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 |