2016-01-23 19:55:01 +00:00
|
|
|
#ifndef _SWAYBAR_STATUS_LINE_H
|
|
|
|
#define _SWAYBAR_STATUS_LINE_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "list.h"
|
2016-01-24 01:34:20 +00:00
|
|
|
#include "bar.h"
|
2016-01-23 19:55:01 +00:00
|
|
|
|
|
|
|
typedef enum {UNDEF, TEXT, I3BAR} command_protocol;
|
|
|
|
|
|
|
|
struct status_line {
|
|
|
|
list_t *block_line;
|
2016-01-24 00:03:08 +00:00
|
|
|
const char *text_line;
|
2016-01-23 19:55:01 +00:00
|
|
|
command_protocol protocol;
|
2017-08-29 09:19:43 +00:00
|
|
|
bool click_events;
|
2016-01-23 19:55:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct status_block {
|
|
|
|
char *full_text, *short_text, *align;
|
|
|
|
bool urgent;
|
|
|
|
uint32_t color;
|
|
|
|
int min_width;
|
|
|
|
char *name, *instance;
|
|
|
|
bool separator;
|
|
|
|
int separator_block_width;
|
2016-04-17 15:38:12 +00:00
|
|
|
bool markup;
|
2016-01-23 19:55:01 +00:00
|
|
|
// Airblader features
|
|
|
|
uint32_t background;
|
|
|
|
uint32_t border;
|
|
|
|
int border_top;
|
|
|
|
int border_bottom;
|
|
|
|
int border_left;
|
|
|
|
int border_right;
|
2017-08-29 09:19:43 +00:00
|
|
|
|
|
|
|
// Set during rendering
|
|
|
|
int x;
|
|
|
|
int width;
|
2016-01-23 19:55:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize status line struct.
|
|
|
|
*/
|
|
|
|
struct status_line *init_status_line();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* handle status line activity.
|
|
|
|
*/
|
2016-01-24 01:34:20 +00:00
|
|
|
bool handle_status_line(struct bar *bar);
|
2016-01-23 19:55:01 +00:00
|
|
|
|
2017-08-29 09:19:43 +00:00
|
|
|
/**
|
|
|
|
* Handle mouse clicks.
|
|
|
|
*/
|
|
|
|
bool status_line_mouse_event(struct bar *bar, int x, int y, uint32_t button);
|
|
|
|
|
2016-01-24 00:03:08 +00:00
|
|
|
/**
|
|
|
|
* Free status line struct.
|
|
|
|
*/
|
|
|
|
void free_status_line(struct status_line *line);
|
|
|
|
|
2016-01-23 19:55:01 +00:00
|
|
|
#endif /* _SWAYBAR_STATUS_LINE_H */
|