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 | |
parent | Check correct ws for sticky and fix floating iter (diff) | |
parent | Merge pull request #2400 from RedSoxFan/swaynag-config-errors (diff) | |
download | sway-e24fc3df18182f3b78cdf90322b0acabfb82a60e.tar.gz sway-e24fc3df18182f3b78cdf90322b0acabfb82a60e.tar.zst sway-e24fc3df18182f3b78cdf90322b0acabfb82a60e.zip |
Merge branch 'master' into fix-2416
Diffstat (limited to 'include')
-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; | |||
150 | sway_cmd cmd_splitv; | 150 | sway_cmd cmd_splitv; |
151 | sway_cmd cmd_sticky; | 151 | sway_cmd cmd_sticky; |
152 | sway_cmd cmd_swaybg_command; | 152 | sway_cmd cmd_swaybg_command; |
153 | sway_cmd cmd_swaynag_command; | ||
153 | sway_cmd cmd_swap; | 154 | sway_cmd cmd_swap; |
154 | sway_cmd cmd_title_format; | 155 | sway_cmd cmd_title_format; |
155 | sway_cmd cmd_unmark; | 156 | 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 @@ | |||
7 | #include <wlr/types/wlr_box.h> | 7 | #include <wlr/types/wlr_box.h> |
8 | #include <xkbcommon/xkbcommon.h> | 8 | #include <xkbcommon/xkbcommon.h> |
9 | #include "list.h" | 9 | #include "list.h" |
10 | #include "swaynag.h" | ||
10 | #include "tree/layout.h" | 11 | #include "tree/layout.h" |
11 | #include "tree/container.h" | 12 | #include "tree/container.h" |
12 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 13 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
@@ -308,6 +309,8 @@ enum focus_wrapping_mode { | |||
308 | * The configuration struct. The result of loading a config file. | 309 | * The configuration struct. The result of loading a config file. |
309 | */ | 310 | */ |
310 | struct sway_config { | 311 | struct sway_config { |
312 | char *swaynag_command; | ||
313 | struct swaynag_instance swaynag_config_errors; | ||
311 | list_t *symbols; | 314 | list_t *symbols; |
312 | list_t *modes; | 315 | list_t *modes; |
313 | list_t *bars; | 316 | list_t *bars; |
@@ -345,6 +348,7 @@ struct sway_config { | |||
345 | bool failed; | 348 | bool failed; |
346 | bool reloading; | 349 | bool reloading; |
347 | bool reading; | 350 | bool reading; |
351 | bool validating; | ||
348 | bool auto_back_and_forth; | 352 | bool auto_back_and_forth; |
349 | bool show_marks; | 353 | bool show_marks; |
350 | 354 | ||
@@ -403,17 +407,19 @@ struct sway_config { | |||
403 | * Loads the main config from the given path. is_active should be true when | 407 | * Loads the main config from the given path. is_active should be true when |
404 | * reloading the config. | 408 | * reloading the config. |
405 | */ | 409 | */ |
406 | bool load_main_config(const char *path, bool is_active); | 410 | bool load_main_config(const char *path, bool is_active, bool validating); |
407 | 411 | ||
408 | /** | 412 | /** |
409 | * Loads an included config. Can only be used after load_main_config. | 413 | * Loads an included config. Can only be used after load_main_config. |
410 | */ | 414 | */ |
411 | bool load_include_configs(const char *path, struct sway_config *config); | 415 | bool load_include_configs(const char *path, struct sway_config *config, |
416 | struct swaynag_instance *swaynag); | ||
412 | 417 | ||
413 | /** | 418 | /** |
414 | * Reads the config from the given FILE. | 419 | * Reads the config from the given FILE. |
415 | */ | 420 | */ |
416 | bool read_config(FILE *file, struct sway_config *config); | 421 | bool read_config(FILE *file, struct sway_config *config, |
422 | struct swaynag_instance *swaynag); | ||
417 | 423 | ||
418 | /** | 424 | /** |
419 | * Free config struct | 425 | * 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 @@ | |||
1 | #ifndef _SWAY_SWAYNAG_H | ||
2 | #define _SWAY_SWAYNAG_H | ||
3 | |||
4 | struct 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. | ||
15 | bool swaynag_spawn(const char *swaynag_command, | ||
16 | struct swaynag_instance *swaynag); | ||
17 | |||
18 | // Kill the swaynag instance | ||
19 | void 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. | ||
23 | void 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 | ||
27 | void swaynag_show(struct swaynag_instance *swaynag); | ||
28 | |||
29 | #endif | ||