Compare commits

..

No commits in common. "wip-pywal" and "main" have entirely different histories.

7 changed files with 4 additions and 48 deletions

4
.gitignore vendored
View file

@ -1,6 +1,6 @@
st.o
st
x.o
config.h
*.o
*.orig
*.rej

View file

@ -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

View file

@ -1,39 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// 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);
}

View file

@ -1,2 +0,0 @@
void colorpywal(void);

View file

@ -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",

1
st.c
View file

@ -1360,7 +1360,6 @@ tdeleteline(int n)
tscrollup(term.c.y, n, 0);
}
int32_t
tdefcolor(const int *attr, int *npar, int l)
{

2
x.c
View file

@ -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) {