]> git.sur5r.net Git - i3/i3/blob - i3bar/include/child.h
51dd5a19f639e1c63de755e729f2dfe328560f9d
[i3/i3] / i3bar / include / child.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3bar - an xcb-based status- and ws-bar for i3
5  * © 2010 Axel Wagner and contributors (see also: LICENSE)
6  *
7  * child.c: Getting input for the statusline
8  *
9  */
10 #pragma once
11
12 #include <config.h>
13
14 #include <stdbool.h>
15
16 #define STDIN_CHUNK_SIZE 1024
17
18 typedef struct {
19     pid_t pid;
20
21     /**
22      * The version number is an uint32_t to avoid machines with different sizes of
23      * 'int' to allow different values here. It’s highly unlikely we ever exceed
24      * even an int8_t, but still…
25      */
26     uint32_t version;
27
28     bool stopped;
29     /**
30      * The signal requested by the client to inform it of the hidden state of i3bar
31      */
32     int stop_signal;
33     /**
34      * The signal requested by the client to inform it of the unhidden state of i3bar
35      */
36     int cont_signal;
37
38     /**
39      * Enable click events
40      */
41     bool click_events;
42     bool click_events_init;
43 } i3bar_child;
44
45 /*
46  * Start a child process with the specified command and reroute stdin.
47  * We actually start a $SHELL to execute the command so we don't have to care
48  * about arguments and such
49  *
50  */
51 void start_child(char *command);
52
53 /*
54  * kill()s the child process (if any). Called when exit()ing.
55  *
56  */
57 void kill_child_at_exit(void);
58
59 /*
60  * kill()s the child process (if any) and closes and
61  * free()s the stdin- and SIGCHLD-watchers
62  *
63  */
64 void kill_child(void);
65
66 /*
67  * Sends a SIGSTOP to the child process (if existent)
68  *
69  */
70 void stop_child(void);
71
72 /*
73  * Sends a SIGCONT to the child process (if existent)
74  *
75  */
76 void cont_child(void);
77
78 /*
79  * Whether or not the child want click events
80  *
81  */
82 bool child_want_click_events(void);
83
84 /*
85  * Generates a click event, if enabled.
86  *
87  */
88 void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int width, int height);