moved all configurable defaults to separate header

This commit is contained in:
podit 2023-02-14 00:16:13 +00:00
parent 1ab43e173a
commit b333822f24
4 changed files with 24 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
dwlb
config.h
*.o
wlr-layer-shell-unstable-v1-protocol.c
wlr-layer-shell-unstable-v1-protocol.h

View File

@ -5,6 +5,9 @@ CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation -g
all: $(BINS)
config.h:
cp config.def.h $@
clean:
$(RM) $(BINS) $(addsuffix .o,$(BINS))
@ -44,7 +47,7 @@ wlr-layer-shell-unstable-v1-protocol.c:
wlr-layer-shell-unstable-v1-protocol.o: wlr-layer-shell-unstable-v1-protocol.h
dwlb.o: utf8.h xdg-shell-protocol.h xdg-output-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h
dwlb.o: utf8.h config.h xdg-shell-protocol.h xdg-output-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h
# Protocol dependencies
dwlb: xdg-shell-protocol.o xdg-output-unstable-v1-protocol.o wlr-layer-shell-unstable-v1-protocol.o

17
config.def.h Normal file
View File

@ -0,0 +1,17 @@
// bar properties
static bool hidden = false;
static bool bottom = false;
static bool hide_vacant = false;
// define the number of tags and the tag names, if the number of tags is
// greater than TAGSLEN they will not be displayed, each tag also needs a name
#define TAGSLEN 9
static char *tags[TAGSLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
// set colors for bar
// TODO: explain the formatting? or at least how a hex color code would be translated
static pixman_color_t activecolor = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
static pixman_color_t inactivecolor = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
static pixman_color_t textcolor = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
static pixman_color_t urgbgcolor = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
static pixman_color_t urgtextcolor = { .red = 2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };

13
dwlb.c
View File

@ -23,6 +23,8 @@
#include "xdg-output-unstable-v1-protocol.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
#include "config.h"
#define DIE(fmt, ...) \
do { \
fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
@ -124,22 +126,11 @@ static Bar *bars = NULL;
static uint32_t height;
static uint32_t textpadding;
static bool hidden = false;
static bool bottom = false;
static bool run_display = true;
static bool ready = false;
static bool hide_vacant = false;
#define TAGSLEN 9
static char *tags[TAGSLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static struct fcft_font *font;
static pixman_color_t activecolor = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
static pixman_color_t inactivecolor = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
static pixman_color_t textcolor = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
static pixman_color_t urgbgcolor = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
static pixman_color_t urgtextcolor = { .red = 2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
static void