i3bar: spelling fixes
This commit is contained in:
parent
8d0fb482d9
commit
e8704bb33b
|
@ -41,7 +41,7 @@ typedef struct {
|
||||||
} i3bar_child;
|
} i3bar_child;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start a child-process with the specified command and reroute stdin.
|
* 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
|
* We actually start a $SHELL to execute the command so we don't have to care
|
||||||
* about arguments and such
|
* about arguments and such
|
||||||
*
|
*
|
||||||
|
@ -49,26 +49,26 @@ typedef struct {
|
||||||
void start_child(char *command);
|
void start_child(char *command);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kill()s the child-process (if any). Called when exit()ing.
|
* kill()s the child process (if any). Called when exit()ing.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void kill_child_at_exit(void);
|
void kill_child_at_exit(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kill()s the child-process (if any) and closes and
|
* kill()s the child process (if any) and closes and
|
||||||
* free()s the stdin- and sigchild-watchers
|
* free()s the stdin- and SIGCHLD-watchers
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void kill_child(void);
|
void kill_child(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sends a SIGSTOP to the child-process (if existent)
|
* Sends a SIGSTOP to the child process (if existent)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stop_child(void);
|
void stop_child(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sends a SIGCONT to the child-process (if existent)
|
* Sends a SIGCONT to the child process (if existent)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cont_child(void);
|
void cont_child(void);
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct config_t {
|
||||||
config_t config;
|
config_t config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start parsing the received bar configuration json-string
|
* Start parsing the received bar configuration JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_config_json(char *json);
|
void parse_config_json(char *json);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initiate a connection to i3.
|
* Initiate a connection to i3.
|
||||||
* socket-path must be a valid path to the ipc_socket of i3
|
* socket_path must be a valid path to the ipc_socket of i3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int init_connection(const char *socket_path);
|
int init_connection(const char *socket_path);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* i3bar - an xcb-based status- and ws-bar for i3
|
* i3bar - an xcb-based status- and ws-bar for i3
|
||||||
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* mode.c: Handle mode-event and show current binding mode in the bar
|
* mode.c: Handle "mode" event and show current binding mode in the bar
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -22,7 +22,7 @@ struct mode {
|
||||||
typedef struct mode mode;
|
typedef struct mode mode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received json-string
|
* Start parsing the received JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_mode_json(char *json);
|
void parse_mode_json(char *json);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* i3bar - an xcb-based status- and ws-bar for i3
|
* i3bar - an xcb-based status- and ws-bar for i3
|
||||||
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* outputs.c: Maintaining the output-list
|
* outputs.c: Maintaining the outputs list
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -19,13 +19,13 @@ SLIST_HEAD(outputs_head, i3_output);
|
||||||
struct outputs_head* outputs;
|
struct outputs_head* outputs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received json-string
|
* Start parsing the received JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_outputs_json(char* json);
|
void parse_outputs_json(char* json);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initiate the output-list
|
* Initiate the outputs list
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_outputs(void);
|
void init_outputs(void);
|
||||||
|
@ -42,7 +42,7 @@ struct i3_output {
|
||||||
bool primary; /* If it is the primary output */
|
bool primary; /* If it is the primary output */
|
||||||
bool visible; /* If the bar is visible on this output */
|
bool visible; /* If the bar is visible on this output */
|
||||||
int ws; /* The number of the currently visible ws */
|
int ws; /* The number of the currently visible ws */
|
||||||
rect rect; /* The rect (relative to the root-win) */
|
rect rect; /* The rect (relative to the root window) */
|
||||||
|
|
||||||
xcb_window_t bar; /* The id of the bar of the output */
|
xcb_window_t bar; /* The id of the bar of the output */
|
||||||
xcb_pixmap_t buffer; /* An extra pixmap for double-buffering */
|
xcb_pixmap_t buffer; /* An extra pixmap for double-buffering */
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#if defined(DLOG)
|
#if defined(DLOG)
|
||||||
#undef DLOG
|
#undef DLOG
|
||||||
#endif
|
#endif
|
||||||
/* Use cool logging-macros */
|
/* Use cool logging macros */
|
||||||
#define DLOG(fmt, ...) \
|
#define DLOG(fmt, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (config.verbose) { \
|
if (config.verbose) { \
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* i3bar - an xcb-based status- and ws-bar for i3
|
* i3bar - an xcb-based status- and ws-bar for i3
|
||||||
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* workspaces.c: Maintaining the workspace-lists
|
* workspaces.c: Maintaining the workspace lists
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -18,13 +18,13 @@ typedef struct i3_ws i3_ws;
|
||||||
TAILQ_HEAD(ws_head, i3_ws);
|
TAILQ_HEAD(ws_head, i3_ws);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received json-string
|
* Start parsing the received JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_workspaces_json(char *json);
|
void parse_workspaces_json(char *json);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* free() all workspace data-structures
|
* free() all workspace data structures
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void free_workspaces(void);
|
void free_workspaces(void);
|
||||||
|
@ -36,7 +36,7 @@ struct i3_ws {
|
||||||
int name_width; /* The rendered width of the name */
|
int name_width; /* The rendered width of the name */
|
||||||
bool visible; /* If the ws is currently visible on an output */
|
bool visible; /* If the ws is currently visible on an output */
|
||||||
bool focused; /* If the ws is currently focused */
|
bool focused; /* If the ws is currently focused */
|
||||||
bool urgent; /* If the urgent-hint of the ws is set */
|
bool urgent; /* If the urgent hint of the ws is set */
|
||||||
rect rect; /* The rect of the ws (not used (yet)) */
|
rect rect; /* The rect of the ws (not used (yet)) */
|
||||||
struct i3_output *output; /* The current output of the ws */
|
struct i3_output *output; /* The current output of the ws */
|
||||||
|
|
||||||
|
|
|
@ -65,14 +65,14 @@ void init_xcb_late(char *fontname);
|
||||||
void init_colors(const struct xcb_color_strings_t *colors);
|
void init_colors(const struct xcb_color_strings_t *colors);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cleanup the xcb-stuff.
|
* Cleanup the xcb stuff.
|
||||||
* Called once, before the program terminates.
|
* Called once, before the program terminates.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void clean_xcb(void);
|
void clean_xcb(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the earlier requested atoms and save them in the prepared data-structure
|
* Get the earlier requested atoms and save them in the prepared data structure
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void get_atoms(void);
|
void get_atoms(void);
|
||||||
|
@ -104,7 +104,7 @@ void init_tray_colors(void);
|
||||||
void destroy_window(i3_output *output);
|
void destroy_window(i3_output *output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reallocate the statusline-buffer
|
* Reallocate the statusline buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void realloc_sl_buffer(void);
|
void realloc_sl_buffer(void);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
/* Global variables for child_*() */
|
/* Global variables for child_*() */
|
||||||
i3bar_child child;
|
i3bar_child child;
|
||||||
|
|
||||||
/* stdin- and sigchild-watchers */
|
/* stdin- and SIGCHLD-watchers */
|
||||||
ev_io *stdin_io;
|
ev_io *stdin_io;
|
||||||
ev_child *child_sig;
|
ev_child *child_sig;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ __attribute__((format(printf, 1, 2))) static void set_statusline_error(const cha
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stop and free() the stdin- and sigchild-watchers
|
* Stop and free() the stdin- and SIGCHLD-watchers
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cleanup(void) {
|
void cleanup(void) {
|
||||||
|
@ -402,8 +402,8 @@ void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We received a sigchild, meaning, that the child-process terminated.
|
* We received a SIGCHLD, meaning, that the child process terminated.
|
||||||
* We simply free the respective data-structures and don't care for input
|
* We simply free the respective data structures and don't care for input
|
||||||
* anymore
|
* anymore
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -440,7 +440,7 @@ void child_write_output(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start a child-process with the specified command and reroute stdin.
|
* 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
|
* We actually start a $SHELL to execute the command so we don't have to care
|
||||||
* about arguments and such.
|
* about arguments and such.
|
||||||
*
|
*
|
||||||
|
@ -568,7 +568,7 @@ void send_block_clicked(int button, const char *name, const char *instance, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kill()s the child-process (if any). Called when exit()ing.
|
* kill()s the child process (if any). Called when exit()ing.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void kill_child_at_exit(void) {
|
void kill_child_at_exit(void) {
|
||||||
|
@ -580,8 +580,8 @@ void kill_child_at_exit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kill()s the child-process (if existent) and closes and
|
* kill()s the child process (if existent) and closes and
|
||||||
* free()s the stdin- and sigchild-watchers
|
* free()s the stdin- and SIGCHLD-watchers
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void kill_child(void) {
|
void kill_child(void) {
|
||||||
|
@ -596,7 +596,7 @@ void kill_child(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sends a SIGSTOP to the child-process (if existent)
|
* Sends a SIGSTOP to the child process (if existent)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stop_child(void) {
|
void stop_child(void) {
|
||||||
|
@ -607,7 +607,7 @@ void stop_child(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sends a SIGCONT to the child-process (if existent)
|
* Sends a SIGCONT to the child process (if existent)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cont_child(void) {
|
void cont_child(void) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int config_map_key_cb(void *params_, const unsigned char *keyVal, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse a null-value (current_workspace)
|
* Parse a null value (current_workspace)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int config_null_cb(void *params_) {
|
static int config_null_cb(void *params_) {
|
||||||
|
@ -231,7 +231,7 @@ static yajl_callbacks outputs_callbacks = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received bar configuration json-string
|
* Start parsing the received bar configuration JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_config_json(char *json) {
|
void parse_config_json(char *json) {
|
||||||
|
@ -247,7 +247,7 @@ void parse_config_json(char *json) {
|
||||||
break;
|
break;
|
||||||
case yajl_status_client_canceled:
|
case yajl_status_client_canceled:
|
||||||
case yajl_status_error:
|
case yajl_status_error:
|
||||||
ELOG("Could not parse config-reply!\n");
|
ELOG("Could not parse config reply!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ typedef void (*handler_t)(char *);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_command_reply(char *reply) {
|
void got_command_reply(char *reply) {
|
||||||
/* TODO: Error handling for command-replies */
|
/* TODO: Error handling for command replies */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called, when we get a reply with workspaces-data
|
* Called, when we get a reply with workspaces data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_workspace_reply(char *reply) {
|
void got_workspace_reply(char *reply) {
|
||||||
|
@ -52,11 +52,11 @@ void got_workspace_reply(char *reply) {
|
||||||
*/
|
*/
|
||||||
void got_subscribe_reply(char *reply) {
|
void got_subscribe_reply(char *reply) {
|
||||||
DLOG("Got Subscribe Reply: %s\n", reply);
|
DLOG("Got Subscribe Reply: %s\n", reply);
|
||||||
/* TODO: Error handling for subscribe-commands */
|
/* TODO: Error handling for subscribe commands */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called, when we get a reply with outputs-data
|
* Called, when we get a reply with outputs data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_output_reply(char *reply) {
|
void got_output_reply(char *reply) {
|
||||||
|
@ -80,7 +80,7 @@ void got_output_reply(char *reply) {
|
||||||
*/
|
*/
|
||||||
void got_bar_config(char *reply) {
|
void got_bar_config(char *reply) {
|
||||||
DLOG("Received bar config \"%s\"\n", reply);
|
DLOG("Received bar config \"%s\"\n", reply);
|
||||||
/* We initiate the main-function by requesting infos about the outputs and
|
/* We initiate the main function by requesting infos about the outputs and
|
||||||
* workspaces. Everything else (creating the bars, showing the right workspace-
|
* workspaces. Everything else (creating the bars, showing the right workspace-
|
||||||
* buttons and more) is taken care of by the event-drivenness of the code */
|
* buttons and more) is taken care of by the event-drivenness of the code */
|
||||||
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL);
|
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL);
|
||||||
|
@ -104,7 +104,7 @@ void got_bar_config(char *reply) {
|
||||||
FREE(config.command);
|
FREE(config.command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data-structure to easily call the reply-handlers later */
|
/* Data-structure to easily call the reply handlers later */
|
||||||
handler_t reply_handlers[] = {
|
handler_t reply_handlers[] = {
|
||||||
&got_command_reply,
|
&got_command_reply,
|
||||||
&got_workspace_reply,
|
&got_workspace_reply,
|
||||||
|
@ -116,7 +116,7 @@ handler_t reply_handlers[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called, when a workspace-event arrives (i.e. the user changed the workspace)
|
* Called, when a workspace event arrives (i.e. the user changed the workspace)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_workspace_event(char *event) {
|
void got_workspace_event(char *event) {
|
||||||
|
@ -125,7 +125,7 @@ void got_workspace_event(char *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called, when an output-event arrives (i.e. the screen-configuration changed)
|
* Called, when an output event arrives (i.e. the screen-configuration changed)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_output_event(char *event) {
|
void got_output_event(char *event) {
|
||||||
|
@ -137,7 +137,7 @@ void got_output_event(char *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called, when a mode-event arrives (i3 changed binding mode).
|
* Called, when a mode event arrives (i3 changed binding mode).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_mode_event(char *event) {
|
void got_mode_event(char *event) {
|
||||||
|
@ -180,7 +180,7 @@ void got_bar_config_update(char *event) {
|
||||||
draw_bars(false);
|
draw_bars(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data-structure to easily call the event-handlers later */
|
/* Data-structure to easily call the event handlers later */
|
||||||
handler_t event_handlers[] = {
|
handler_t event_handlers[] = {
|
||||||
&got_workspace_event,
|
&got_workspace_event,
|
||||||
&got_output_event,
|
&got_output_event,
|
||||||
|
@ -316,7 +316,7 @@ int i3_send_msg(uint32_t type, const char *payload) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initiate a connection to i3.
|
* Initiate a connection to i3.
|
||||||
* socket-path must be a valid path to the ipc_socket of i3
|
* socket_path must be a valid path to the ipc_socket of i3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int init_connection(const char *socket_path) {
|
int init_connection(const char *socket_path) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ void print_usage(char *elf_name) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("-b, --bar_id <bar_id>\tBar ID for which to get the configuration\n");
|
printf("-b, --bar_id <bar_id>\tBar ID for which to get the configuration\n");
|
||||||
printf("-s, --socket <sock_path>\tConnect to i3 via <sock_path>\n");
|
printf("-s, --socket <sock_path>\tConnect to i3 via <sock_path>\n");
|
||||||
printf("-h, --help Display this help-message and exit\n");
|
printf("-h, --help Display this help message and exit\n");
|
||||||
printf("-v, --version Display version number and exit\n");
|
printf("-v, --version Display version number and exit\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" PLEASE NOTE that i3bar will be automatically started by i3\n"
|
printf(" PLEASE NOTE that i3bar will be automatically started by i3\n"
|
||||||
|
@ -71,7 +71,7 @@ void print_usage(char *elf_name) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We watch various signals, that are there to make our application stop.
|
* We watch various signals, that are there to make our application stop.
|
||||||
* If we get one of those, we ev_unloop() and invoke the cleanup-routines
|
* If we get one of those, we ev_unloop() and invoke the cleanup routines
|
||||||
* in main() with that
|
* in main() with that
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -150,7 +150,7 @@ int main(int argc, char **argv) {
|
||||||
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG, config.bar_id);
|
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG, config.bar_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We listen to SIGTERM/QUIT/INT and try to exit cleanly, by stopping the main-loop.
|
/* We listen to SIGTERM/QUIT/INT and try to exit cleanly, by stopping the main loop.
|
||||||
* We only need those watchers on the stack, so putting them on the stack saves us
|
* We only need those watchers on the stack, so putting them on the stack saves us
|
||||||
* some calls to free() */
|
* some calls to free() */
|
||||||
ev_signal *sig_term = smalloc(sizeof(ev_signal));
|
ev_signal *sig_term = smalloc(sizeof(ev_signal));
|
||||||
|
@ -166,7 +166,7 @@ int main(int argc, char **argv) {
|
||||||
ev_signal_start(main_loop, sig_hup);
|
ev_signal_start(main_loop, sig_hup);
|
||||||
|
|
||||||
/* From here on everything should run smooth for itself, just start listening for
|
/* From here on everything should run smooth for itself, just start listening for
|
||||||
* events. We stop simply stop the event-loop, when we are finished */
|
* events. We stop simply stop the event loop, when we are finished */
|
||||||
ev_loop(main_loop, 0);
|
ev_loop(main_loop, 0);
|
||||||
|
|
||||||
kill_child();
|
kill_child();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* i3bar - an xcb-based status- and ws-bar for i3
|
* i3bar - an xcb-based status- and ws-bar for i3
|
||||||
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* mode.c: Handle mode-event and show current binding mode in the bar
|
* mode.c: Handle mode event and show current binding mode in the bar
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -48,7 +48,7 @@ static int mode_string_cb(void *params_, const unsigned char *val, size_t len) {
|
||||||
/*
|
/*
|
||||||
* Parse a key.
|
* Parse a key.
|
||||||
*
|
*
|
||||||
* Essentially we just save it in the parsing-state
|
* Essentially we just save it in the parsing state
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int mode_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
static int mode_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
||||||
|
@ -69,11 +69,11 @@ static yajl_callbacks mode_callbacks = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received json-string
|
* Start parsing the received JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_mode_json(char *json) {
|
void parse_mode_json(char *json) {
|
||||||
/* FIXME: Fasciliate stream-processing, i.e. allow starting to interpret
|
/* FIXME: Fasciliate stream processing, i.e. allow starting to interpret
|
||||||
* JSON in chunks */
|
* JSON in chunks */
|
||||||
struct mode_json_params params;
|
struct mode_json_params params;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ void parse_mode_json(char *json) {
|
||||||
break;
|
break;
|
||||||
case yajl_status_client_canceled:
|
case yajl_status_client_canceled:
|
||||||
case yajl_status_error:
|
case yajl_status_error:
|
||||||
ELOG("Could not parse mode-event!\n");
|
ELOG("Could not parse mode event!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* i3bar - an xcb-based status- and ws-bar for i3
|
* i3bar - an xcb-based status- and ws-bar for i3
|
||||||
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* outputs.c: Maintaining the output-list
|
* outputs.c: Maintaining the outputs list
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -27,7 +27,7 @@ struct outputs_json_params {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse a null-value (current_workspace)
|
* Parse a null value (current_workspace)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int outputs_null_cb(void *params_) {
|
static int outputs_null_cb(void *params_) {
|
||||||
|
@ -139,7 +139,7 @@ static int outputs_string_cb(void *params_, const unsigned char *val, size_t len
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We hit the start of a json-map (rect or a new output)
|
* We hit the start of a JSON map (rect or a new output)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int outputs_start_map_cb(void *params_) {
|
static int outputs_start_map_cb(void *params_) {
|
||||||
|
@ -221,7 +221,7 @@ static int outputs_end_map_cb(void *params_) {
|
||||||
/*
|
/*
|
||||||
* Parse a key.
|
* Parse a key.
|
||||||
*
|
*
|
||||||
* Essentially we just save it in the parsing-state
|
* Essentially we just save it in the parsing state
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int outputs_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
static int outputs_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
||||||
|
@ -247,7 +247,7 @@ static yajl_callbacks outputs_callbacks = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initiate the output-list
|
* Initiate the outputs list
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_outputs(void) {
|
void init_outputs(void) {
|
||||||
|
@ -256,7 +256,7 @@ void init_outputs(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received json-string
|
* Start parsing the received JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_outputs_json(char *json) {
|
void parse_outputs_json(char *json) {
|
||||||
|
@ -279,7 +279,7 @@ void parse_outputs_json(char *json) {
|
||||||
break;
|
break;
|
||||||
case yajl_status_client_canceled:
|
case yajl_status_client_canceled:
|
||||||
case yajl_status_error:
|
case yajl_status_error:
|
||||||
ELOG("Could not parse outputs-reply!\n");
|
ELOG("Could not parse outputs reply!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* i3bar - an xcb-based status- and ws-bar for i3
|
* i3bar - an xcb-based status- and ws-bar for i3
|
||||||
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* workspaces.c: Maintaining the workspace-lists
|
* workspaces.c: Maintaining the workspace lists
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -167,7 +167,7 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We hit the start of a json-map (rect or a new output)
|
* We hit the start of a JSON map (rect or a new output)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int workspaces_start_map_cb(void *params_) {
|
static int workspaces_start_map_cb(void *params_) {
|
||||||
|
@ -195,7 +195,7 @@ static int workspaces_start_map_cb(void *params_) {
|
||||||
/*
|
/*
|
||||||
* Parse a key.
|
* Parse a key.
|
||||||
*
|
*
|
||||||
* Essentially we just save it in the parsing-state
|
* Essentially we just save it in the parsing state
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int workspaces_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
static int workspaces_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
||||||
|
@ -219,11 +219,11 @@ static yajl_callbacks workspaces_callbacks = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start parsing the received json-string
|
* Start parsing the received JSON string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void parse_workspaces_json(char *json) {
|
void parse_workspaces_json(char *json) {
|
||||||
/* FIXME: Fasciliate stream-processing, i.e. allow starting to interpret
|
/* FIXME: Fasciliate stream processing, i.e. allow starting to interpret
|
||||||
* JSON in chunks */
|
* JSON in chunks */
|
||||||
struct workspaces_json_params params;
|
struct workspaces_json_params params;
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ void parse_workspaces_json(char *json) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* free() all workspace data-structures. Does not free() the heads of the tailqueues.
|
* free() all workspace data structures. Does not free() the heads of the tailqueues.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void free_workspaces(void) {
|
void free_workspaces(void) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ const static int tray_loff_px = 2;
|
||||||
/* Vertical offset between the bar and a separator */
|
/* Vertical offset between the bar and a separator */
|
||||||
const static int sep_voff_px = 4;
|
const static int sep_voff_px = 4;
|
||||||
|
|
||||||
/* We define xcb_request_failed as a macro to include the relevant line-number */
|
/* We define xcb_request_failed as a macro to include the relevant line number */
|
||||||
#define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__)
|
#define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__)
|
||||||
int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line) {
|
int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line) {
|
||||||
xcb_generic_error_t *err;
|
xcb_generic_error_t *err;
|
||||||
|
@ -349,8 +349,8 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle a button-press-event (i.e. a mouse click on one of our bars).
|
* Handle a button press event (i.e. a mouse click on one of our bars).
|
||||||
* We determine, whether the click occured on a ws-button or if the scroll-
|
* We determine, whether the click occured on a workspace button or if the scroll-
|
||||||
* wheel was used and change the workspace appropriately
|
* wheel was used and change the workspace appropriately
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -516,7 +516,7 @@ void handle_button(xcb_button_press_event_t *event) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle visibility notifications: when none of the bars are visible, e.g.
|
* Handle visibility notifications: when none of the bars are visible, e.g.
|
||||||
* if windows are in full-screen on each output, suspend the child process.
|
* if windows are in fullscreen on each output, suspend the child process.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
|
static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
|
||||||
|
@ -881,7 +881,7 @@ static void handle_property_notify(xcb_property_notify_event_t *event) {
|
||||||
DLOG("xembed version = %d\n", xembed[0]);
|
DLOG("xembed version = %d\n", xembed[0]);
|
||||||
DLOG("xembed flags = %d\n", xembed[1]);
|
DLOG("xembed flags = %d\n", xembed[1]);
|
||||||
bool map_it = ((xembed[1] & XEMBED_MAPPED) == XEMBED_MAPPED);
|
bool map_it = ((xembed[1] & XEMBED_MAPPED) == XEMBED_MAPPED);
|
||||||
DLOG("map-state now %d\n", map_it);
|
DLOG("map state now %d\n", map_it);
|
||||||
if (trayclient->mapped && !map_it) {
|
if (trayclient->mapped && !map_it) {
|
||||||
/* need to unmap the window */
|
/* need to unmap the window */
|
||||||
xcb_unmap_window(xcb_connection, trayclient->win);
|
xcb_unmap_window(xcb_connection, trayclient->win);
|
||||||
|
@ -1020,7 +1020,7 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
|
||||||
redraw_bars();
|
redraw_bars();
|
||||||
break;
|
break;
|
||||||
case XCB_BUTTON_PRESS:
|
case XCB_BUTTON_PRESS:
|
||||||
/* Button-press-events are mouse-buttons clicked on one of our bars */
|
/* Button press events are mouse-buttons clicked on one of our bars */
|
||||||
handle_button((xcb_button_press_event_t *)event);
|
handle_button((xcb_button_press_event_t *)event);
|
||||||
break;
|
break;
|
||||||
case XCB_CLIENT_MESSAGE:
|
case XCB_CLIENT_MESSAGE:
|
||||||
|
@ -1127,9 +1127,9 @@ char *init_xcb_early() {
|
||||||
|
|
||||||
char *path = root_atom_contents("I3_SOCKET_PATH", xcb_connection, screen);
|
char *path = root_atom_contents("I3_SOCKET_PATH", xcb_connection, screen);
|
||||||
|
|
||||||
if (xcb_request_failed(sl_pm_cookie, "Could not allocate statusline-buffer") ||
|
if (xcb_request_failed(sl_pm_cookie, "Could not allocate statusline buffer") ||
|
||||||
xcb_request_failed(clear_ctx_cookie, "Could not allocate statusline-buffer-clearcontext") ||
|
xcb_request_failed(clear_ctx_cookie, "Could not allocate statusline buffer clearcontext") ||
|
||||||
xcb_request_failed(sl_ctx_cookie, "Could not allocate statusline-buffer-context")) {
|
xcb_request_failed(sl_ctx_cookie, "Could not allocate statusline buffer context")) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ char *init_xcb_early() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register for xkb keyevents. To grab modifiers without blocking other applications from receiving key-events
|
* Register for xkb keyevents. To grab modifiers without blocking other applications from receiving key events
|
||||||
* involving that modifier, we sadly have to use xkb which is not yet fully supported
|
* involving that modifier, we sadly have to use xkb which is not yet fully supported
|
||||||
* in xcb.
|
* in xcb.
|
||||||
*
|
*
|
||||||
|
@ -1343,7 +1343,7 @@ void init_tray_colors(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cleanup the xcb-stuff.
|
* Cleanup the xcb stuff.
|
||||||
* Called once, before the program terminates.
|
* Called once, before the program terminates.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -1453,11 +1453,11 @@ void destroy_window(i3_output *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reallocate the statusline-buffer
|
* Reallocate the statusline buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void realloc_sl_buffer(void) {
|
void realloc_sl_buffer(void) {
|
||||||
DLOG("Re-allocating statusline-buffer, statusline_width = %d, root_screen->width_in_pixels = %d\n",
|
DLOG("Re-allocating statusline buffer, statusline_width = %d, root_screen->width_in_pixels = %d\n",
|
||||||
statusline_width, root_screen->width_in_pixels);
|
statusline_width, root_screen->width_in_pixels);
|
||||||
xcb_free_pixmap(xcb_connection, statusline_pm);
|
xcb_free_pixmap(xcb_connection, statusline_pm);
|
||||||
statusline_pm = xcb_generate_id(xcb_connection);
|
statusline_pm = xcb_generate_id(xcb_connection);
|
||||||
|
@ -1488,9 +1488,9 @@ void realloc_sl_buffer(void) {
|
||||||
mask,
|
mask,
|
||||||
vals);
|
vals);
|
||||||
|
|
||||||
if (xcb_request_failed(sl_pm_cookie, "Could not allocate statusline-buffer") ||
|
if (xcb_request_failed(sl_pm_cookie, "Could not allocate statusline buffer") ||
|
||||||
xcb_request_failed(clear_ctx_cookie, "Could not allocate statusline-buffer-clearcontext") ||
|
xcb_request_failed(clear_ctx_cookie, "Could not allocate statusline buffer clearcontext") ||
|
||||||
xcb_request_failed(sl_ctx_cookie, "Could not allocate statusline-buffer-context")) {
|
xcb_request_failed(sl_ctx_cookie, "Could not allocate statusline buffer context")) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1521,7 +1521,7 @@ void reconfig_windows(bool redraw_bars) {
|
||||||
mask = XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
|
mask = XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
|
||||||
/* Black background */
|
/* Black background */
|
||||||
values[0] = colors.bar_bg;
|
values[0] = colors.bar_bg;
|
||||||
/* If hide_on_modifier is set to hide or invisible mode, i3 is not supposed to manage our bar-windows */
|
/* If hide_on_modifier is set to hide or invisible mode, i3 is not supposed to manage our bar windows */
|
||||||
values[1] = (config.hide_on_modifier == M_DOCK ? 0 : 1);
|
values[1] = (config.hide_on_modifier == M_DOCK ? 0 : 1);
|
||||||
/* We enable the following EventMask fields:
|
/* We enable the following EventMask fields:
|
||||||
* EXPOSURE, to get expose events (we have to re-draw then)
|
* EXPOSURE, to get expose events (we have to re-draw then)
|
||||||
|
@ -1583,7 +1583,7 @@ void reconfig_windows(bool redraw_bars) {
|
||||||
name);
|
name);
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
/* We want dock-windows (for now). When override_redirect is set, i3 is ignoring
|
/* We want dock windows (for now). When override_redirect is set, i3 is ignoring
|
||||||
* this one */
|
* this one */
|
||||||
xcb_void_cookie_t dock_cookie = xcb_change_property(xcb_connection,
|
xcb_void_cookie_t dock_cookie = xcb_change_property(xcb_connection,
|
||||||
XCB_PROP_MODE_REPLACE,
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
@ -1638,7 +1638,7 @@ void reconfig_windows(bool redraw_bars) {
|
||||||
12,
|
12,
|
||||||
&strut_partial);
|
&strut_partial);
|
||||||
|
|
||||||
/* We also want a graphics-context for the bars (it defines the properties
|
/* We also want a graphics context for the bars (it defines the properties
|
||||||
* with which we draw to them) */
|
* with which we draw to them) */
|
||||||
walk->bargc = xcb_generate_id(xcb_connection);
|
walk->bargc = xcb_generate_id(xcb_connection);
|
||||||
xcb_void_cookie_t gc_cookie = xcb_create_gc_checked(xcb_connection,
|
xcb_void_cookie_t gc_cookie = xcb_create_gc_checked(xcb_connection,
|
||||||
|
|
Loading…
Reference in New Issue