diff --git a/.gitignore b/.gitignore index 8002050..39a6daf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ - +st.o st +x.o config.h -*.o *.orig *.rej \ No newline at end of file diff --git a/Makefile b/Makefile index 69da496..15db421 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ include config.mk -SRC = st.c x.c colors.c +SRC = st.c x.c OBJ = $(SRC:.c=.o) all: st diff --git a/colors.c b/colors.c deleted file mode 100644 index d1ef77f..0000000 --- a/colors.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include - -// Declare the colorname array (defined in config.h) -extern char *colorname[]; - -void colorpywal() { - const char *home_dir = getenv("HOME"); - if (home_dir == NULL) { - fprintf(stderr, "Error: Could not determine home directory.\n"); - return; - } else { - fprintf(stdout, "Debug: Found Home Directory.\n"); - } - - // Construct the path to the Pywal colors file - char pywal_colors_path[256]; - snprintf(pywal_colors_path, sizeof(pywal_colors_path), "%s/.cache/wal/colors", home_dir); - fprintf(stdout, "Debug: PyWal Path: %s", pywal_colors_path); - FILE *fp = fopen(pywal_colors_path, "r"); - if (fp == NULL) { - // Pywal colors file not found, do nothing - return; - } - - char line[256]; - int i = 0; - - // Read colors from the file and update the colorname array - while (fgets(line, sizeof(line), fp) != NULL && i < 16) { - line[strcspn(line, "\n")] = 0; // Remove newline character - colorname[i] = strdup(line); // Duplicate the color string - i++; - } - - // Clean up - fclose(fp); -} \ No newline at end of file diff --git a/colors.h b/colors.h deleted file mode 100644 index 9d13440..0000000 --- a/colors.h +++ /dev/null @@ -1,2 +0,0 @@ - -void colorpywal(void); \ No newline at end of file diff --git a/config.def.h b/config.def.h index 6b95ec7..84929f3 100644 --- a/config.def.h +++ b/config.def.h @@ -97,7 +97,7 @@ unsigned int tabspaces = 8; float alpha = 0.8; /* Terminal colors (16 first used in escape sequence) */ -char *colorname[] = { +static const char *colorname[] = { /* 8 normal colors */ "black", "red3", diff --git a/st.c b/st.c index bc01391..f17abbc 100644 --- a/st.c +++ b/st.c @@ -1360,7 +1360,6 @@ tdeleteline(int n) tscrollup(term.c.y, n, 0); } - int32_t tdefcolor(const int *attr, int *npar, int l) { diff --git a/x.c b/x.c index c96f78c..ecbbbd1 100644 --- a/x.c +++ b/x.c @@ -17,7 +17,6 @@ char *argv0; #include "arg.h" -#include "colors.h" #include "st.h" #include "win.h" @@ -772,7 +771,6 @@ sixd_to_16bit(int x) int xloadcolor(int i, const char *name, Color *ncolor) { - colorpywal(); XRenderColor color = { .alpha = 0xffff }; if (!name) {