summaryrefslogtreecommitdiff
path: root/dmenu/dmenu.c
diff options
context:
space:
mode:
authorauric <104602845+ihateamongus@users.noreply.github.com>2025-09-07 19:26:35 -0500
committerGitHub <noreply@github.com>2025-09-07 19:26:35 -0500
commit54b41bddc00449b446b0f9dbddb037954cd6a265 (patch)
tree2849f3dea2612f11f9f1496c00ad3344ec0df644 /dmenu/dmenu.c
parent8661540682391f5f6db33a86747028d90dda09ed (diff)
parent30b8f7faf8b3d58971672cadf97084d2a897bea9 (diff)
Merge pull request #10 from ihateamongus/codex/analyze-oldresources-folder-for-performance-x6iukv
Add glass-style transparency and dynamic tags
Diffstat (limited to 'dmenu/dmenu.c')
-rw-r--r--dmenu/dmenu.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/dmenu/dmenu.c b/dmenu/dmenu.c
index 066d20f..54a14e2 100644
--- a/dmenu/dmenu.c
+++ b/dmenu/dmenu.c
@@ -57,18 +57,13 @@ static XIC xic;
static Drw *drw;
static Clr *scheme[SchemeLast];
-#define SHMNAME "/breathing_color_shm"
-typedef struct {
-uint32_t seq;
-char color[8];
-} ColorShm;
+#include "../accent.h"
static ColorShm *accentshm;
static char accentcol[8] = "#005577";
static const double opacity = 0.85;
static void initaccent(void);
static void updateaccent(void);
-static int openaccent(void);
static void setopacity(Window w, double opacity);
#include "config.h"
@@ -130,40 +125,11 @@ cleanup(void)
XCloseDisplay(dpy);
}
-static int
-openaccent(void)
-{
- int fd;
- if (accentshm)
- return 1;
- if ((fd = shm_open(SHMNAME, O_RDONLY, 0)) < 0)
- return 0;
- accentshm = mmap(NULL, sizeof(ColorShm), PROT_READ, MAP_SHARED, fd, 0);
- close(fd);
- if (accentshm == MAP_FAILED) {
- accentshm = NULL;
- return 0;
- }
- return 1;
-}
-
static void
updateaccent(void)
{
- uint32_t s1, s2;
- char tmp[8];
-
- if (!accentshm && !openaccent())
- return;
- 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);
+ if (readaccent(&accentshm, accentcol))
+ drw_clr_create(drw, &scheme[SchemeSel][ColBg], accentcol);
}
static void