4 * i3 - an improved dynamic tiling window manager
6 * (c) 2009 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
20 * Starts the given application by passing it through a shell. We use double fork
21 * to avoid zombie processes. As the started application’s parent exits (immediately),
22 * the application is reparented to init (process-id 1), which correctly handles
23 * childs, so we don’t have to do it :-).
25 * The shell is determined by looking for the SHELL environment variable. If it
26 * does not exist, /bin/sh is used.
29 void start_application(const char *command) {
33 /* Stores the path of the shell */
34 static const char *shell = NULL;
37 if ((shell = getenv("SHELL")) == NULL)
40 /* This is the child */
41 execl(shell, shell, "-c", command, NULL);
50 * Checks a generic cookie for errors and quits with the given message if there
54 void check_error(xcb_connection_t *connection, xcb_void_cookie_t cookie, char *err_message) {
55 xcb_generic_error_t *error = xcb_request_check(connection, cookie);
57 fprintf(stderr, "ERROR: %s : %d\n", err_message , error->error_code);
58 xcb_disconnect(connection);