diff options
Diffstat (limited to 'i3bar/include/child.h')
-rw-r--r-- | i3bar/include/child.h | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/i3bar/include/child.h b/i3bar/include/child.h index ae523bc0..e77b51e3 100644 --- a/i3bar/include/child.h +++ b/i3bar/include/child.h @@ -11,7 +11,7 @@ #include <config.h> -#include <stdbool.h> +#include <ev.h> #define STDIN_CHUNK_SIZE 1024 @@ -40,6 +40,18 @@ typedef struct { */ bool click_events; bool click_events_init; + + /** + * stdin- and SIGCHLD-watchers + */ + ev_io *stdin_io; + ev_child *child_sig; + int stdin_fd; + + /** + * Line read from child that did not include a newline character. + */ + char *pending_line; } i3bar_child; /* @@ -50,36 +62,66 @@ void clear_statusline(struct statusline_head *head, bool free_resources); /* * Start a child process with the specified command and reroute stdin. - * We actually start a $SHELL to execute the command so we don't have to care - * about arguments and such + * We actually start a shell to execute the command so we don't have to care + * about arguments and such. + * + * If `command' is NULL, such as in the case when no `status_command' is given + * in the bar config, no child will be started. * */ void start_child(char *command); /* + * Same as start_child but starts the configured client that manages workspace + * buttons. + * + */ +void start_ws_child(char *command); + +/* + * Returns true if the status child process is alive. + * + */ +bool status_child_is_alive(void); + +/* + * Returns true if the workspace child process is alive. + * + */ +bool ws_child_is_alive(void); + +/* * kill()s the child process (if any). Called when exit()ing. * */ -void kill_child_at_exit(void); +void kill_children_at_exit(void); /* - * kill()s the child process (if any) and closes and - * free()s the stdin- and SIGCHLD-watchers + * kill()s the child process (if any) and closes and free()s the stdin- and + * SIGCHLD-watchers * */ void kill_child(void); /* + * kill()s the workspace child process (if any) and closes and free()s the + * stdin- and SIGCHLD-watchers. + * Similar to kill_child. + * + */ +void kill_ws_child(void); + +/* * Sends a SIGSTOP to the child process (if existent) * */ -void stop_child(void); +void stop_children(void); /* * Sends a SIGCONT to the child process (if existent) * */ -void cont_child(void); +void cont_children(void); /* * Whether or not the child want click events @@ -92,3 +134,14 @@ bool child_want_click_events(void); * */ void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int out_x, int out_y, int width, int height, int mods); + +/* + * When workspace_command is enabled this function is used to re-parse the + * latest received JSON from the client. + */ +void repeat_last_ws_json(void); + +/* + * Replaces the workspace buttons with an error message. + */ +void set_workspace_button_error(const char *message); |