Support a detailed message in swaynagbar

This commit is contained in:
Brian Ashworth 2018-07-27 01:30:35 -04:00
parent 88bc4b528e
commit 72db10c2f1
5 changed files with 321 additions and 14 deletions

View file

@ -7,17 +7,26 @@
#define NAGBAR_BAR_BORDER_THICKNESS 2
#define NAGBAR_MESSAGE_PADDING 8
#define NAGBAR_DETAILS_BORDER_THICKNESS 3
#define NAGBAR_BUTTON_BORDER_THICKNESS 3
#define NAGBAR_BUTTON_GAP 20
#define NAGBAR_BUTTON_GAP_CLOSE 15
#define NAGBAR_BUTTON_MARGIN_RIGHT 2
#define NAGBAR_BUTTON_PADDING 3
#define NAGBAR_MAX_HEIGHT 500
enum sway_nagbar_type {
NAGBAR_ERROR,
NAGBAR_WARNING,
};
enum sway_nagbar_action_type {
NAGBAR_ACTION_DISMISS,
NAGBAR_ACTION_EXPAND,
NAGBAR_ACTION_COMMAND,
};
struct sway_nagbar_colors {
uint32_t button_background;
uint32_t background;
@ -43,6 +52,7 @@ struct sway_nagbar_output {
struct sway_nagbar_button {
char *text;
enum sway_nagbar_action_type type;
char *action;
int x;
int y;
@ -50,6 +60,22 @@ struct sway_nagbar_button {
int height;
};
struct sway_nagbar_details {
bool visible;
char *message;
int x;
int y;
int width;
int height;
int offset;
int visible_lines;
int total_lines;
struct sway_nagbar_button button_up;
struct sway_nagbar_button button_down;
};
struct sway_nagbar {
bool run_display;
int querying_outputs;
@ -77,6 +103,7 @@ struct sway_nagbar {
char *message;
char *font;
list_t *buttons;
struct sway_nagbar_details details;
};
void nagbar_setup(struct sway_nagbar *nagbar);