mirror of
https://github.com/kolunmi/dwlb.git
synced 2025-10-29 19:24:17 +00:00
commit
6ff69669c3
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
dwlb
|
dwlb
|
||||||
|
config.h
|
||||||
*.o
|
*.o
|
||||||
wlr-layer-shell-unstable-v1-protocol.c
|
wlr-layer-shell-unstable-v1-protocol.c
|
||||||
wlr-layer-shell-unstable-v1-protocol.h
|
wlr-layer-shell-unstable-v1-protocol.h
|
||||||
|
|||||||
5
Makefile
5
Makefile
@ -5,6 +5,9 @@ CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation -g
|
|||||||
|
|
||||||
all: $(BINS)
|
all: $(BINS)
|
||||||
|
|
||||||
|
config.h:
|
||||||
|
cp config.def.h $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(BINS) $(addsuffix .o,$(BINS))
|
$(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
|
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
|
# Protocol dependencies
|
||||||
dwlb: xdg-shell-protocol.o xdg-output-unstable-v1-protocol.o wlr-layer-shell-unstable-v1-protocol.o
|
dwlb: xdg-shell-protocol.o xdg-output-unstable-v1-protocol.o wlr-layer-shell-unstable-v1-protocol.o
|
||||||
|
|||||||
19
config.def.h
Normal file
19
config.def.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// bar properties
|
||||||
|
static bool hidden = false;
|
||||||
|
static bool bottom = false;
|
||||||
|
static bool hide_vacant = false;
|
||||||
|
|
||||||
|
// font
|
||||||
|
static char *fontstr = "monospace:size=10";
|
||||||
|
|
||||||
|
// tag names
|
||||||
|
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
|
||||||
|
// set 16-bit colors for bar
|
||||||
|
// 8-bit color can be converted to 16-bit color by simply duplicating values e.g
|
||||||
|
// 0x55 -> 0x5555, 0xf1 -> 0xf1f1
|
||||||
|
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 = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
|
||||||
32
dwlb.c
32
dwlb.c
@ -48,6 +48,8 @@
|
|||||||
((a) < (b) ? (a) : (b))
|
((a) < (b) ? (a) : (b))
|
||||||
#define MAX(a, b) \
|
#define MAX(a, b) \
|
||||||
((a) > (b) ? (a) : (b))
|
((a) > (b) ? (a) : (b))
|
||||||
|
#define LENGTH(X) \
|
||||||
|
(sizeof X / sizeof X[0])
|
||||||
|
|
||||||
#define PROGRAM "dwlb"
|
#define PROGRAM "dwlb"
|
||||||
#define VERSION "0.1"
|
#define VERSION "0.1"
|
||||||
@ -63,7 +65,7 @@
|
|||||||
" -inactive-color [COLOR] specify color to indicate inactive tags or monitors\n" \
|
" -inactive-color [COLOR] specify color to indicate inactive tags or monitors\n" \
|
||||||
" -urg-text-color [COLOR] specify text color on urgent tags\n" \
|
" -urg-text-color [COLOR] specify text color on urgent tags\n" \
|
||||||
" -urg-bg-color [COLOR] specify color of urgent tags\n" \
|
" -urg-bg-color [COLOR] specify color of urgent tags\n" \
|
||||||
" -tags [TAG 1]...[TAG 9] specify custom tag names\n" \
|
" -tags [FIRST TAG]...[LAST TAG] specify custom tag names\n" \
|
||||||
"Commands\n" \
|
"Commands\n" \
|
||||||
" -status [OUTPUT] [TEXT] set status text\n" \
|
" -status [OUTPUT] [TEXT] set status text\n" \
|
||||||
" -show [OUTPUT] show bar\n" \
|
" -show [OUTPUT] show bar\n" \
|
||||||
@ -120,27 +122,18 @@ static struct wl_shm *shm;
|
|||||||
static struct zwlr_layer_shell_v1 *layer_shell;
|
static struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
static struct zxdg_output_manager_v1 *output_manager;
|
static struct zxdg_output_manager_v1 *output_manager;
|
||||||
|
|
||||||
|
static struct fcft_font *font;
|
||||||
|
|
||||||
static Bar *bars = NULL;
|
static Bar *bars = NULL;
|
||||||
|
|
||||||
|
// TODO: it would be nice to have these be configurable, currently set by font
|
||||||
static uint32_t height;
|
static uint32_t height;
|
||||||
static uint32_t textpadding;
|
static uint32_t textpadding;
|
||||||
static bool hidden = false;
|
|
||||||
static bool bottom = false;
|
|
||||||
|
|
||||||
static bool run_display = true;
|
static bool run_display = true;
|
||||||
static bool ready = false;
|
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, };
|
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wl_buffer_release(void *data, struct wl_buffer *wl_buffer)
|
wl_buffer_release(void *data, struct wl_buffer *wl_buffer)
|
||||||
@ -399,7 +392,7 @@ draw_frame(Bar *b)
|
|||||||
uint32_t boxs = font->height / 9;
|
uint32_t boxs = font->height / 9;
|
||||||
uint32_t boxw = font->height / 6 + 2;
|
uint32_t boxw = font->height / 6 + 2;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < TAGSLEN; i++) {
|
for (uint32_t i = 0; i < LENGTH(tags); i++) {
|
||||||
bool active = b->mtags & 1 << i;
|
bool active = b->mtags & 1 << i;
|
||||||
bool occupied = b->ctags & 1 << i;
|
bool occupied = b->ctags & 1 << i;
|
||||||
bool urgent = b->urg & 1 << i;
|
bool urgent = b->urg & 1 << i;
|
||||||
@ -985,7 +978,6 @@ sig_handler(int sig)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *fontstr = "";
|
|
||||||
char *xdgruntimedir;
|
char *xdgruntimedir;
|
||||||
struct sockaddr_un sock_address;
|
struct sockaddr_un sock_address;
|
||||||
Bar *b, *t;
|
Bar *b, *t;
|
||||||
@ -1072,11 +1064,11 @@ main(int argc, char **argv)
|
|||||||
if (parse_color(argv[i], &urgbgcolor) == -1)
|
if (parse_color(argv[i], &urgbgcolor) == -1)
|
||||||
DIE("malformed color string");
|
DIE("malformed color string");
|
||||||
} else if (!strcmp(argv[i], "-tags")) {
|
} else if (!strcmp(argv[i], "-tags")) {
|
||||||
if (i + TAGSLEN >= argc)
|
if (i + (int)LENGTH(tags) >= argc)
|
||||||
DIE("Option -tags requires %i arguments", TAGSLEN);
|
DIE("Option -tags requires %lu arguments", LENGTH(tags));
|
||||||
for (int j = 0; j < TAGSLEN; j++)
|
for (int j = 0; j < (int)LENGTH(tags); j++)
|
||||||
tags[j] = argv[i + 1 + j];
|
tags[j] = argv[i + 1 + j];
|
||||||
i += TAGSLEN;
|
i += LENGTH(tags);
|
||||||
} else if (!strcmp(argv[i], "-v")) {
|
} else if (!strcmp(argv[i], "-v")) {
|
||||||
fprintf(stderr, PROGRAM " " VERSION "\n");
|
fprintf(stderr, PROGRAM " " VERSION "\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user