2 * i3bar - an xcb-based status- and ws-bar for i3
4 * © 2010 Axel Wagner and contributors
6 * See file LICNSE for license information
8 * src/xcb.c: Communicating with X
12 #include <xcb/xproto.h>
13 #include <xcb/xcb_atom.h>
24 #include <X11/XKBlib.h>
25 #include <X11/extensions/XKB.h>
29 /* We save the Atoms in an easy to access array, indexed by an enum */
33 #define ATOM_DO(name) name,
34 #include "xcb_atoms.def"
37 xcb_intern_atom_cookie_t atom_cookies[NUM_ATOMS];
38 xcb_atom_t atoms[NUM_ATOMS];
40 /* Variables, that are the same for all functions at all times */
41 xcb_connection_t *xcb_connection;
42 xcb_screen_t *xcb_screen;
43 xcb_window_t xcb_root;
46 /* We need to cache some data to speed up text-width-prediction */
47 xcb_query_font_reply_t *font_info;
49 xcb_charinfo_t *font_table;
51 /* These are only relevant for XKB, which we only need for grabbing modifiers */
56 /* Because the statusline is the same on all outputs, we have
57 * global buffer to render it on */
58 xcb_gcontext_t statusline_ctx;
59 xcb_pixmap_t statusline_pm;
60 uint32_t statusline_width;
62 /* Event-Watchers, to interact with the user */
68 /* The parsed colors */
72 uint32_t active_ws_fg;
73 uint32_t active_ws_bg;
74 uint32_t inactive_ws_fg;
75 uint32_t inactive_ws_bg;
76 uint32_t urgent_ws_bg;
77 uint32_t urgent_ws_fg;
79 struct xcb_colors_t colors;
81 /* We define xcb_request_failed as a macro to include the relevant line-number */
82 #define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__)
83 int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line) {
84 xcb_generic_error_t *err;
85 if ((err = xcb_request_check(xcb_connection, cookie)) != NULL) {
86 ELOG("%s. X Error Code: %d\n", err_msg, err->error_code);
87 return err->error_code;
93 * Predicts the length of text based on cached data.
94 * The string has to be encoded in ucs2 and glyph_len has to be the length
95 * of the string (in glyphs).
98 uint32_t predict_text_extents(xcb_char2b_t *text, uint32_t length) {
99 /* If we don't have per-character data, return the maximum width */
100 if (font_table == NULL) {
101 return (font_info->max_bounds.character_width * length);
107 for (i = 0; i < length; i++) {
108 xcb_charinfo_t *info;
109 int row = text[i].byte1;
110 int col = text[i].byte2;
112 if (row < font_info->min_byte1 || row > font_info->max_byte1 ||
113 col < font_info->min_char_or_byte2 || col > font_info->max_char_or_byte2) {
117 /* Don't you ask me, how this one works… */
118 info = &font_table[((row - font_info->min_byte1) *
119 (font_info->max_char_or_byte2 - font_info->min_char_or_byte2 + 1)) +
120 (col - font_info->min_char_or_byte2)];
122 if (info->character_width != 0 ||
123 (info->right_side_bearing |
124 info->left_side_bearing |
126 info->descent) != 0) {
127 width += info->character_width;
135 * Draws text given in UCS-2-encoding to a given drawable and position
138 void draw_text(xcb_drawable_t drawable, xcb_gcontext_t ctx, int16_t x, int16_t y,
139 xcb_char2b_t *text, uint32_t glyph_count) {
142 int16_t font_ascent = font_info->font_ascent;
144 while (glyph_count > 0) {
145 uint8_t chunk_size = MIN(255, glyph_count);
146 uint32_t chunk_width = predict_text_extents(text + offset, chunk_size);
148 xcb_image_text_16(xcb_connection,
152 pos_x, y + font_ascent,
155 offset += chunk_size;
156 pos_x += chunk_width;
157 glyph_count -= chunk_size;
162 * Converts a colorstring to a colorpixel as expected from xcb_change_gc.
163 * s is assumed to be in the format "rrggbb"
166 uint32_t get_colorpixel(const char *s) {
167 char strings[3][3] = { { s[0], s[1], '\0'} ,
168 { s[2], s[3], '\0'} ,
169 { s[4], s[5], '\0'} };
170 uint8_t r = strtol(strings[0], NULL, 16);
171 uint8_t g = strtol(strings[1], NULL, 16);
172 uint8_t b = strtol(strings[2], NULL, 16);
173 return (r << 16 | g << 8 | b);
177 * Redraws the statusline to the buffer
180 void refresh_statusline() {
183 if (statusline == NULL) {
187 xcb_char2b_t *text = (xcb_char2b_t*) convert_utf8_to_ucs2(statusline, &glyph_count);
188 statusline_width = predict_text_extents(text, glyph_count);
190 xcb_free_pixmap(xcb_connection, statusline_pm);
191 statusline_pm = xcb_generate_id(xcb_connection);
192 xcb_void_cookie_t sl_pm_cookie = xcb_create_pixmap_checked(xcb_connection,
193 xcb_screen->root_depth,
199 draw_text(statusline_pm, statusline_ctx, 0, 0, text, glyph_count);
203 if (xcb_request_failed(sl_pm_cookie, "Could not allocate statusline-buffer")) {
209 * Hides all bars (unmaps them)
213 if (!config.hide_on_modifier) {
218 SLIST_FOREACH(walk, outputs, slist) {
219 xcb_unmap_window(xcb_connection, walk->bar);
225 * Unhides all bars (maps them)
229 if (!config.hide_on_modifier) {
234 xcb_void_cookie_t cookie;
240 SLIST_FOREACH(walk, outputs, slist) {
241 if (walk->bar == XCB_NONE) {
244 mask = XCB_CONFIG_WINDOW_X |
245 XCB_CONFIG_WINDOW_Y |
246 XCB_CONFIG_WINDOW_WIDTH |
247 XCB_CONFIG_WINDOW_HEIGHT |
248 XCB_CONFIG_WINDOW_STACK_MODE;
249 values[0] = walk->rect.x;
250 values[1] = walk->rect.y + walk->rect.h - font_height - 6;
251 values[2] = walk->rect.w;
252 values[3] = font_height + 6;
253 values[4] = XCB_STACK_MODE_ABOVE;
254 DLOG("Reconfiguring Window for output %s to %d,%d\n", walk->name, values[0], values[1]);
255 cookie = xcb_configure_window_checked(xcb_connection,
260 if (xcb_request_failed(cookie, "Could not reconfigure window")) {
263 xcb_map_window(xcb_connection, walk->bar);
268 * Parse the colors into a format that we can use
271 void init_colors(const struct xcb_color_strings_t *new_colors) {
272 #define PARSE_COLOR(name, def) \
274 colors.name = get_colorpixel(new_colors->name ? new_colors->name : def); \
276 PARSE_COLOR(bar_fg, "FFFFFF");
277 PARSE_COLOR(bar_bg, "000000");
278 PARSE_COLOR(active_ws_fg, "FFFFFF");
279 PARSE_COLOR(active_ws_bg, "480000");
280 PARSE_COLOR(inactive_ws_fg, "FFFFFF");
281 PARSE_COLOR(inactive_ws_bg, "240000");
282 PARSE_COLOR(urgent_ws_fg, "FFFFFF");
283 PARSE_COLOR(urgent_ws_bg, "002400");
288 * Handle a button-press-event (i.c. a mouse click on one of our bars).
289 * We determine, wether the click occured on a ws-button or if the scroll-
290 * wheel was used and change the workspace appropriately
293 void handle_button(xcb_button_press_event_t *event) {
296 /* Determine, which bar was clicked */
298 xcb_window_t bar = event->event;
299 SLIST_FOREACH(walk, outputs, slist) {
300 if (walk->bar == bar) {
306 DLOG("Unknown Bar klicked!\n");
310 /* TODO: Move this to extern get_ws_for_output() */
311 TAILQ_FOREACH(cur_ws, walk->workspaces, tailq) {
312 if (cur_ws->visible) {
317 if (cur_ws == NULL) {
318 DLOG("No Workspace active?\n");
322 int32_t x = event->event_x;
324 DLOG("Got Button %d\n", event->detail);
326 switch (event->detail) {
328 /* Left Mousbutton. We determine, which button was clicked
329 * and set cur_ws accordingly */
330 TAILQ_FOREACH(cur_ws, walk->workspaces, tailq) {
332 if (x < cur_ws->name_width + 10) {
335 x -= cur_ws->name_width + 10;
337 if (cur_ws == NULL) {
342 /* Mouse wheel down. We select the next ws */
343 if (cur_ws == TAILQ_FIRST(walk->workspaces)) {
344 cur_ws = TAILQ_LAST(walk->workspaces, ws_head);
346 cur_ws = TAILQ_PREV(cur_ws, ws_head, tailq);
350 /* Mouse wheel up. We select the previos ws */
351 if (cur_ws == TAILQ_LAST(walk->workspaces, ws_head)) {
352 cur_ws = TAILQ_FIRST(walk->workspaces);
354 cur_ws = TAILQ_NEXT(cur_ws, tailq);
359 char buffer[strlen(cur_ws->name) + 11];
360 snprintf(buffer, 50, "workspace %s", cur_ws->name);
361 i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, buffer);
365 * This function is called immediately bevor the main loop locks. We flush xcb
366 * then (and only then)
369 void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
370 xcb_flush(xcb_connection);
374 * This function is called immediately after the main loop locks, so when one
375 * of the watchers registered an event.
376 * We check wether an X-Event arrived and handle it.
379 void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
380 xcb_generic_event_t *event;
381 while ((event = xcb_poll_for_event(xcb_connection)) == NULL) {
385 switch (event->response_type & ~0x80) {
387 /* Expose-events happen, when the window needs to be redrawn */
390 case XCB_BUTTON_PRESS:
391 /* Button-press-events are mouse-buttons clicked on one of our bars */
392 handle_button((xcb_button_press_event_t*) event);
399 * Dummy Callback. We only need this, so that the Prepare- and Check-Watchers
403 void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
407 * We need to bind to the modifier per XKB. Sadly, XCB does not implement this
410 void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
414 DLOG("Got XKB-Event!\n");
416 while (XPending(xkb_dpy)) {
417 XNextEvent(xkb_dpy, (XEvent*)&ev);
419 if (ev.type != xkb_event_base) {
420 ELOG("No Xkb-Event!\n");
424 if (ev.any.xkb_type != XkbStateNotify) {
425 ELOG("No State Notify!\n");
429 unsigned int mods = ev.state.mods;
430 modstate = mods & Mod4Mask;
433 if (modstate != mod_pressed) {
435 DLOG("Mod4 got released!\n");
438 DLOG("Mod4 got pressed!\n");
441 mod_pressed = modstate;
446 * Initialize xcb and use the specified fontname for text-rendering
449 void init_xcb(char *fontname) {
450 /* FIXME: xcb_connect leaks Memory */
451 xcb_connection = xcb_connect(NULL, NULL);
452 if (xcb_connection_has_error(xcb_connection)) {
453 ELOG("Cannot open display\n");
456 DLOG("Connected to xcb\n");
458 /* We have to request the atoms we need */
459 #define ATOM_DO(name) atom_cookies[name] = xcb_intern_atom(xcb_connection, 0, strlen(#name), #name);
460 #include "xcb_atoms.def"
462 xcb_screen = xcb_setup_roots_iterator(xcb_get_setup(xcb_connection)).data;
463 xcb_root = xcb_screen->root;
465 /* We load and allocate the font */
466 xcb_font = xcb_generate_id(xcb_connection);
467 xcb_void_cookie_t open_font_cookie;
468 open_font_cookie = xcb_open_font_checked(xcb_connection,
473 /* We need to save info about the font, because we need the fonts height and
474 * information about the width of characters */
475 xcb_query_font_cookie_t query_font_cookie;
476 query_font_cookie = xcb_query_font(xcb_connection,
479 /* To grab modifiers without blocking other applications from receiving key-events
480 * involving that modifier, we sadly have to use xkb which is not yet fully supported
482 if (config.hide_on_modifier) {
483 int xkb_major, xkb_minor, xkb_errbase, xkb_err;
484 xkb_major = XkbMajorVersion;
485 xkb_minor = XkbMinorVersion;
487 char *dispname = getenv("DISPLAY");
488 if (dispname == NULL) {
491 xkb_dpy = XkbOpenDisplay(dispname,
498 if (xkb_dpy == NULL) {
503 if (fcntl(ConnectionNumber(xkb_dpy), F_SETFD, FD_CLOEXEC) == -1) {
504 ELOG("Could not set FD_CLOEXEC on xkbdpy: %s\n", strerror(errno));
509 if (!XkbQueryExtension(xkb_dpy, &i1, &xkb_event_base, &xkb_errbase, &xkb_major, &xkb_minor)) {
510 ELOG("XKB not supported by X-server!\n");
514 if (!XkbSelectEvents(xkb_dpy, XkbUseCoreKbd, XkbStateNotifyMask, XkbStateNotifyMask)) {
515 ELOG("Could not grab Key!\n");
519 xkb_io = malloc(sizeof(ev_io));
520 ev_io_init(xkb_io, &xkb_io_cb, ConnectionNumber(xkb_dpy), EV_READ);
521 ev_io_start(main_loop, xkb_io);
525 /* We draw the statusline to a seperate pixmap, because it looks the same on all bars and
526 * this way, we can choose to crop it */
527 statusline_ctx = xcb_generate_id(xcb_connection);
528 uint32_t mask = XCB_GC_FOREGROUND |
531 uint32_t vals[3] = { colors.bar_fg, colors.bar_bg, xcb_font };
533 xcb_void_cookie_t sl_ctx_cookie = xcb_create_gc_checked(xcb_connection,
539 /* We only generate an id for the pixmap, because the width of it is dependent on the
541 statusline_pm = xcb_generate_id(xcb_connection);
543 /* The varios Watchers to communicate with xcb */
544 xcb_io = malloc(sizeof(ev_io));
545 xcb_prep = malloc(sizeof(ev_prepare));
546 xcb_chk = malloc(sizeof(ev_check));
548 ev_io_init(xcb_io, &xcb_io_cb, xcb_get_file_descriptor(xcb_connection), EV_READ);
549 ev_prepare_init(xcb_prep, &xcb_prep_cb);
550 ev_check_init(xcb_chk, &xcb_chk_cb);
552 ev_io_start(main_loop, xcb_io);
553 ev_prepare_start(main_loop, xcb_prep);
554 ev_check_start(main_loop, xcb_chk);
556 /* Now we get the atoms and save them in a nice data-structure */
559 /* Now we save the font-infos */
560 font_info = xcb_query_font_reply(xcb_connection,
564 if (xcb_request_failed(open_font_cookie, "Could not open font")) {
568 font_height = font_info->font_ascent + font_info->font_descent;
570 if (xcb_query_font_char_infos_length(font_info) == 0) {
573 font_table = xcb_query_font_char_infos(font_info);
576 DLOG("Calculated Font-height: %d\n", font_height);
578 if (xcb_request_failed(sl_ctx_cookie, "Could not create context for statusline")) {
584 * Cleanup the xcb-stuff.
585 * Called once, before the program terminates.
591 SLIST_FOREACH(o_walk, outputs, slist) {
592 destroy_window(o_walk);
593 FREE(o_walk->workspaces);
596 FREE_SLIST(outputs, i3_output);
599 xcb_disconnect(xcb_connection);
601 ev_check_stop(main_loop, xcb_chk);
602 ev_prepare_stop(main_loop, xcb_prep);
603 ev_io_stop(main_loop, xcb_io);
612 * Get the earlier requested atoms and save them in the prepared data-structure
616 xcb_intern_atom_reply_t *reply;
617 #define ATOM_DO(name) reply = xcb_intern_atom_reply(xcb_connection, atom_cookies[name], NULL); \
618 if (reply == NULL) { \
619 ELOG("Could not get atom %s\n", #name); \
620 exit(EXIT_FAILURE); \
622 atoms[name] = reply->atom; \
625 #include "xcb_atoms.def"
630 * Destroy the bar of the specified output
633 void destroy_window(i3_output *output) {
634 if (output == NULL) {
637 if (output->bar == XCB_NONE) {
640 xcb_destroy_window(xcb_connection, output->bar);
641 output->bar = XCB_NONE;
645 * Reconfigure all bars and create new for newly activated outputs
648 void reconfig_windows() {
653 SLIST_FOREACH(walk, outputs, slist) {
655 /* If an output is not active, we destroy it's bar */
656 /* FIXME: Maybe we rather want to unmap? */
657 DLOG("Destroying window for output %s\n", walk->name);
658 destroy_window(walk);
661 if (walk->bar == XCB_NONE) {
662 DLOG("Creating Window for output %s\n", walk->name);
664 walk->bar = xcb_generate_id(xcb_connection);
665 walk->buffer = xcb_generate_id(xcb_connection);
666 mask = XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
667 /* Black background */
668 values[0] = colors.bar_bg;
669 /* If hide_on_modifier is set, i3 is not supposed to manage our bar-windows */
670 values[1] = config.hide_on_modifier;
671 /* The events we want to receive */
672 values[2] = XCB_EVENT_MASK_EXPOSURE |
673 XCB_EVENT_MASK_BUTTON_PRESS;
674 xcb_void_cookie_t win_cookie = xcb_create_window_checked(xcb_connection,
675 xcb_screen->root_depth,
678 walk->rect.x, walk->rect.y + walk->rect.h - font_height - 6,
679 walk->rect.w, font_height + 6,
681 XCB_WINDOW_CLASS_INPUT_OUTPUT,
682 xcb_screen->root_visual,
686 /* The double-buffer we use to render stuff off-screen */
687 xcb_void_cookie_t pm_cookie = xcb_create_pixmap_checked(xcb_connection,
688 xcb_screen->root_depth,
694 /* We want dock-windows (for now). When override_redirect is set, i3 is ignoring
696 xcb_void_cookie_t dock_cookie = xcb_change_property(xcb_connection,
697 XCB_PROP_MODE_REPLACE,
699 atoms[_NET_WM_WINDOW_TYPE],
703 (unsigned char*) &atoms[_NET_WM_WINDOW_TYPE_DOCK]);
705 /* We need to tell i3, where to reserve space for i3bar */
706 /* left, right, top, bottom, left_start_y, left_end_y,
707 * right_start_y, right_end_y, top_start_x, top_end_x, bottom_start_x,
709 /* A local struct to save the strut_partial property */
715 uint32_t left_start_y;
717 uint32_t right_start_y;
718 uint32_t right_end_y;
719 uint32_t top_start_x;
721 uint32_t bottom_start_x;
722 uint32_t bottom_end_x;
723 } __attribute__((__packed__)) strut_partial = {0,};
724 switch (config.dockpos) {
728 strut_partial.top = font_height + 6;
729 strut_partial.top_start_x = walk->rect.x;
730 strut_partial.top_end_x = walk->rect.x + walk->rect.w;
733 strut_partial.bottom = font_height + 6;
734 strut_partial.bottom_start_x = walk->rect.x;
735 strut_partial.bottom_end_x = walk->rect.x + walk->rect.w;
738 xcb_void_cookie_t strut_cookie = xcb_change_property(xcb_connection,
739 XCB_PROP_MODE_REPLACE,
741 atoms[_NET_WM_STRUT_PARTIAL],
747 /* We also want a graphics-context for the bars (it defines the properties
748 * with which we draw to them) */
749 walk->bargc = xcb_generate_id(xcb_connection);
751 values[0] = xcb_font;
752 xcb_void_cookie_t gc_cookie = xcb_create_gc_checked(xcb_connection,
758 /* We finally map the bar (display it on screen), unless the modifier-switch is on */
759 xcb_void_cookie_t map_cookie;
760 if (!config.hide_on_modifier) {
761 map_cookie = xcb_map_window_checked(xcb_connection, walk->bar);
764 if (xcb_request_failed(win_cookie, "Could not create window") ||
765 xcb_request_failed(pm_cookie, "Could not create pixmap") ||
766 xcb_request_failed(dock_cookie, "Could not set dock mode") ||
767 xcb_request_failed(strut_cookie, "Could not set strut") ||
768 xcb_request_failed(gc_cookie, "Could not create graphical context") ||
769 (!config.hide_on_modifier && xcb_request_failed(map_cookie, "Could not map window"))) {
773 /* We already have a bar, so we just reconfigure it */
774 mask = XCB_CONFIG_WINDOW_X |
775 XCB_CONFIG_WINDOW_Y |
776 XCB_CONFIG_WINDOW_WIDTH |
777 XCB_CONFIG_WINDOW_HEIGHT |
778 XCB_CONFIG_WINDOW_STACK_MODE;
779 values[0] = walk->rect.x;
780 values[1] = walk->rect.y + walk->rect.h - font_height - 6;
781 values[2] = walk->rect.w;
782 values[3] = font_height + 6;
783 values[4] = XCB_STACK_MODE_ABOVE;
785 DLOG("Destroying buffer for output %s", walk->name);
786 xcb_free_pixmap(xcb_connection, walk->buffer);
788 DLOG("Reconfiguring Window for output %s to %d,%d\n", walk->name, values[0], values[1]);
789 xcb_void_cookie_t cfg_cookie = xcb_configure_window_checked(xcb_connection,
794 DLOG("Recreating buffer for output %s", walk->name);
795 xcb_void_cookie_t pm_cookie = xcb_create_pixmap_checked(xcb_connection,
796 xcb_screen->root_depth,
802 if (xcb_request_failed(cfg_cookie, "Could not reconfigure window")) {
805 if (xcb_request_failed(pm_cookie, "Could not create pixmap")) {
813 * Render the bars, with buttons and statusline
817 DLOG("Drawing Bars...\n");
820 refresh_statusline();
822 i3_output *outputs_walk;
823 SLIST_FOREACH(outputs_walk, outputs, slist) {
824 if (!outputs_walk->active) {
825 DLOG("Output %s inactive, skipping...\n", outputs_walk->name);
828 if (outputs_walk->bar == XCB_NONE) {
829 /* Oh shit, an active output without an own bar. Create it now! */
832 /* First things first: clear the backbuffer */
833 uint32_t color = colors.bar_bg;
834 xcb_change_gc(xcb_connection,
838 xcb_rectangle_t rect = { 0, 0, outputs_walk->rect.w, font_height + 6 };
839 xcb_poly_fill_rectangle(xcb_connection,
840 outputs_walk->buffer,
845 if (statusline != NULL) {
846 DLOG("Printing statusline!\n");
848 /* Luckily we already prepared a seperate pixmap containing the rendered
849 * statusline, we just have to copy the relevant parts to the relevant
851 xcb_copy_area(xcb_connection,
853 outputs_walk->buffer,
855 MAX(0, (int16_t)(statusline_width - outputs_walk->rect.w + 4)), 0,
856 MAX(0, (int16_t)(outputs_walk->rect.w - statusline_width - 4)), 3,
857 MIN(outputs_walk->rect.w - 4, statusline_width), font_height);
861 TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
862 DLOG("Drawing Button for WS %s at x = %d\n", ws_walk->name, i);
863 uint32_t fg_color = colors.inactive_ws_fg;
864 uint32_t bg_color = colors.inactive_ws_bg;
865 if (ws_walk->visible) {
866 fg_color = colors.active_ws_fg;
867 bg_color = colors.active_ws_bg;
869 if (ws_walk->urgent) {
870 DLOG("WS %s is urgent!\n", ws_walk->name);
871 fg_color = colors.urgent_ws_fg;
872 bg_color = colors.urgent_ws_bg;
873 /* The urgent-hint should get noticed, so we unhide the bars shortly */
876 xcb_change_gc(xcb_connection,
880 xcb_change_gc(xcb_connection,
884 xcb_rectangle_t rect = { i + 1, 1, ws_walk->name_width + 8, font_height + 4 };
885 xcb_poly_fill_rectangle(xcb_connection,
886 outputs_walk->buffer,
890 xcb_change_gc(xcb_connection,
894 xcb_image_text_16(xcb_connection,
895 ws_walk->name_glyphs,
896 outputs_walk->buffer,
898 i + 5, font_info->font_ascent + 2,
900 i += 10 + ws_walk->name_width;
910 * Redraw the bars, i.e. simply copy the buffer to the barwindow
914 i3_output *outputs_walk;
915 SLIST_FOREACH(outputs_walk, outputs, slist) {
916 xcb_copy_area(xcb_connection,
917 outputs_walk->buffer,
922 outputs_walk->rect.w,
923 outputs_walk->rect.h);
924 xcb_flush(xcb_connection);