yambar/bar/bar.h
Kyle Gunger 37b5b02fc4 Fixes for size setting and config
+ height is optional
+ width is optional
+ make location enum into bitmask
2023-01-17 21:23:47 -05:00

63 lines
1.5 KiB
C

#pragma once
#include "../color.h"
#include "../font-shaping.h"
#include "../module.h"
struct bar {
int abort_fd;
void *private;
int (*run)(struct bar *bar);
void (*destroy)(struct bar *bar);
void (*refresh)(const struct bar *bar);
void (*set_cursor)(struct bar *bar, const char *cursor);
const char *(*output_name)(const struct bar *bar);
};
enum bar_location { BAR_TOP = 0b1, BAR_BOTTOM = 0b10, BAR_LEFT = 0b100, BAR_RIGHT = 0b1000 };
enum bar_layer { BAR_LAYER_TOP, BAR_LAYER_BOTTOM };
enum bar_backend { BAR_BACKEND_AUTO, BAR_BACKEND_XCB, BAR_BACKEND_WAYLAND };
struct bar_config {
enum bar_backend backend;
const char *monitor;
enum bar_layer layer;
enum bar_location location;
enum font_shaping font_shaping;
int height;
int left_spacing, right_spacing;
int left_margin, right_margin;
int width;
int top_spacing, bottom_spacing;
int top_margin, bottom_margin;
int trackpad_sensitivity;
pixman_color_t background;
struct {
int left_width, right_width;
int top_width, bottom_width;
pixman_color_t color;
int left_margin, right_margin;
int top_margin, bottom_margin;
} border;
struct {
struct module **mods;
size_t count;
} left;
struct {
struct module **mods;
size_t count;
} center;
struct {
struct module **mods;
size_t count;
} right;
};
struct bar *bar_new(const struct bar_config *config);