refactor both i3-nagbar starts into src/util.c

With this change, libev >= 4 is a hard dependency. It should be present
in all major linux distributions (even the latest ubuntu LTS).
This commit is contained in:
Michael Stapelberg
2012-12-24 16:53:20 +01:00
parent c127ac3855
commit b3d7531947
12 changed files with 271 additions and 389 deletions

View File

@ -12,6 +12,8 @@
#include <yajl/yajl_gen.h>
extern pid_t config_error_nagbar_pid;
/*
* The result of a parse_config call. Currently unused, but the JSON output
* will be useful in the future when we implement a config parsing IPC command.

View File

@ -10,6 +10,8 @@
#ifndef I3_KEY_PRESS_H
#define I3_KEY_PRESS_H
extern pid_t command_error_nagbar_pid;
/**
* There was a key press. We compare this key code with our bindings table and pass
* the bound action to parse_command().

View File

@ -355,4 +355,10 @@ xcb_visualtype_t *get_visualtype(xcb_screen_t *screen);
*/
bool is_debug_build() __attribute__((const));
/**
* Returns the name of a temporary file with the specified prefix.
*
*/
char *get_process_filename(const char *prefix);
#endif

View File

@ -105,13 +105,6 @@ char *resolve_tilde(const char *path);
*/
bool path_exists(const char *path);
/**
* Returns the name of a temporary file with the specified prefix.
*
*/
char *get_process_filename(const char *prefix);
/**
* Restart i3 in-place
* appends -a to argument list to disable autostart
@ -130,4 +123,23 @@ void *memmem(const void *l, size_t l_len, const void *s, size_t s_len);
#endif
/**
* Starts an i3-nagbar instance with the given parameters. Takes care of
* handling SIGCHLD and killing i3-nagbar when i3 exits.
*
* The resulting PID will be stored in *nagbar_pid and can be used with
* kill_nagbar() to kill the bar later on.
*
*/
void start_nagbar(pid_t *nagbar_pid, char *argv[]);
/**
* Kills the i3-nagbar process, if *nagbar_pid != -1.
*
* If wait_for_it is set (restarting i3), this function will waitpid(),
* otherwise, ev is assumed to handle it (reloading).
*
*/
void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it);
#endif