summaryrefslogtreecommitdiff
path: root/tools/exofetch.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 /tools/exofetch.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 'tools/exofetch.c')
-rw-r--r--tools/exofetch.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/tools/exofetch.c b/tools/exofetch.c
index bc5548a..826464d 100644
--- a/tools/exofetch.c
+++ b/tools/exofetch.c
@@ -10,48 +10,16 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <locale.h>
-
-#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 int
-openaccent(void)
-{
- int fd;
- if (accentshm)
- return 0;
- if ((fd = shm_open(SHMNAME, O_RDONLY, 0)) < 0)
- return -1;
- accentshm = mmap(NULL, sizeof(ColorShm), PROT_READ, MAP_SHARED, fd, 0);
- close(fd);
- if (accentshm == MAP_FAILED) {
- accentshm = NULL;
- return -1;
- }
- return 0;
-}
-
static void
updateaccent(void)
{
- uint32_t s1, s2;
- char tmp[8];
- if (!accentshm && openaccent() < 0)
- return;
- do {
- s1 = accentshm->seq;
- memcpy(tmp, accentshm->color, 8);
- s2 = accentshm->seq;
- } while (s1 != s2);
- if (tmp[0] == '#')
- memcpy(accentcol, tmp, 8);
+ if (!readaccent(&accentshm, accentcol))
+ memcpy(accentcol, "#005577", 8);
}
static void
@@ -127,7 +95,6 @@ int
main(void)
{
setlocale(LC_ALL, "");
- openaccent();
updateaccent();
int r, g, b;
hex2rgb(accentcol, &r, &g, &b);