summaryrefslogtreecommitdiff
path: root/dwm/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm/dwm.c')
-rw-r--r--dwm/dwm.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/dwm/dwm.c b/dwm/dwm.c
index 7a15419..8eccf8f 100644
--- a/dwm/dwm.c
+++ b/dwm/dwm.c
@@ -318,6 +318,19 @@ typedef struct {
static ColorShm *accentshm;
static char accentcol[8] = "#005577";
+#ifndef BAROPACITY
+#define BAROPACITY 1.0
+#endif
+
+/* tag used for scratchpad clients */
+static const unsigned int scratchtag = 1 << LENGTH(tags);
+
+#include "../accent.h"
+
+/* state for the shared accent color */
+static ColorShm *accentshm;
+static char accentcol[8] = "#005577";
+
/* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@@ -697,34 +710,17 @@ createmon(void)
static void
updateaccent(void) {
- if (!accentshm)
- return;
- uint32_t s1, s2;
- char tmp[8];
- do {
- s1 = accentshm->seq;
- memcpy(tmp, accentshm->color, 8);
- s2 = accentshm->seq;
- } while (s1 != s2);
- if (tmp[0] != '#')
- return;
- memcpy(accentcol, tmp, 8);
- drw_clr_create(drw, &scheme[SchemeSel][ColBg], accentcol);
- drw_clr_create(drw, &scheme[SchemeSel][ColBorder], accentcol);
- for (Monitor *m = mons; m; m = m->next)
- if (m->sel)
- XSetWindowBorder(dpy, m->sel->win, scheme[SchemeSel][ColBorder].pixel);
+ if (readaccent(&accentshm, accentcol)) {
+ drw_clr_create(drw, &scheme[SchemeSel][ColBg], accentcol);
+ drw_clr_create(drw, &scheme[SchemeSel][ColBorder], accentcol);
+ for (Monitor *m = mons; m; m = m->next)
+ if (m->sel)
+ XSetWindowBorder(dpy, m->sel->win, scheme[SchemeSel][ColBorder].pixel);
+ }
}
static void
initaccent(void) {
- int fd = shm_open(SHMNAME, O_RDONLY, 0);
- if (fd >= 0) {
- accentshm = mmap(NULL, sizeof(ColorShm), PROT_READ, MAP_SHARED, fd, 0);
- close(fd);
- if (accentshm == MAP_FAILED)
- accentshm = NULL;
- }
updateaccent();
}