2010-08-07 12:05:16 -04:00
|
|
|
/*
|
|
|
|
* i3bar - an xcb-based status- and ws-bar for i3
|
|
|
|
*
|
|
|
|
* © 2010 Axel Wagner and contributors
|
|
|
|
*
|
|
|
|
* See file LICNSE for license information
|
|
|
|
*
|
|
|
|
*/
|
2010-07-21 19:15:18 -04:00
|
|
|
#ifndef XCB_H_
|
|
|
|
#define XCB_H_
|
|
|
|
|
2010-10-23 23:24:51 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
struct colors_t {
|
|
|
|
char *bar_fg;
|
|
|
|
char *bar_bg;
|
|
|
|
char *active_ws_fg;
|
|
|
|
char *active_ws_bg;
|
|
|
|
char *inactive_ws_fg;
|
|
|
|
char *inactive_ws_bg;
|
|
|
|
char *urgent_ws_bg;
|
|
|
|
char *urgent_ws_fg;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct parsed_colors_t {
|
|
|
|
uint32_t bar_fg;
|
|
|
|
uint32_t bar_bg;
|
|
|
|
uint32_t active_ws_fg;
|
|
|
|
uint32_t active_ws_bg;
|
|
|
|
uint32_t inactive_ws_fg;
|
|
|
|
uint32_t inactive_ws_bg;
|
|
|
|
uint32_t urgent_ws_bg;
|
|
|
|
uint32_t urgent_ws_fg;
|
|
|
|
};
|
|
|
|
|
2010-08-06 20:10:05 -04:00
|
|
|
/*
|
|
|
|
* Initialize xcb and use the specified fontname for text-rendering
|
|
|
|
*
|
|
|
|
*/
|
2010-07-21 19:15:18 -04:00
|
|
|
void init_xcb();
|
2010-08-06 20:10:05 -04:00
|
|
|
|
2010-10-23 23:24:51 -04:00
|
|
|
/*
|
|
|
|
* Initialize the colors
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void init_colors(const struct colors_t *colors);
|
|
|
|
|
2010-08-06 20:10:05 -04:00
|
|
|
/*
|
|
|
|
* Cleanup the xcb-stuff.
|
|
|
|
* Called once, before the program terminates.
|
|
|
|
*
|
|
|
|
*/
|
2010-07-21 19:15:18 -04:00
|
|
|
void clean_xcb();
|
2010-08-06 20:10:05 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the earlier requested atoms and save them in the prepared data-structure
|
|
|
|
*
|
|
|
|
*/
|
2010-07-21 19:15:18 -04:00
|
|
|
void get_atoms();
|
2010-08-06 20:10:05 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy the bar of the specified output
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void destroy_window(i3_output *output);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reconfigure all bars and create new for newly activated outputs
|
|
|
|
*
|
|
|
|
*/
|
2010-08-05 21:32:05 -04:00
|
|
|
void reconfig_windows();
|
2010-08-06 20:10:05 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Render the bars, with buttons and statusline
|
|
|
|
*
|
|
|
|
*/
|
2010-08-03 21:34:18 -04:00
|
|
|
void draw_bars();
|
2010-08-06 20:10:05 -04:00
|
|
|
|
2010-08-22 04:24:32 -04:00
|
|
|
/*
|
|
|
|
* Redraw the bars, i.e. simply copy the buffer to the barwindow
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void redraw_bars();
|
|
|
|
|
2010-08-06 20:10:05 -04:00
|
|
|
/*
|
2010-09-16 21:11:49 -04:00
|
|
|
* Predicts the length of text based on cached data.
|
2010-08-06 20:10:05 -04:00
|
|
|
* The string has to be encoded in ucs2 and glyph_len has to be the length
|
2010-09-16 21:11:49 -04:00
|
|
|
* of the string (in glyphs).
|
2010-08-06 20:10:05 -04:00
|
|
|
*
|
|
|
|
*/
|
2010-09-16 21:11:49 -04:00
|
|
|
uint32_t predict_text_extents(xcb_char2b_t *text, uint32_t length);
|
2010-07-21 19:15:18 -04:00
|
|
|
|
|
|
|
#endif
|