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
4
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
|
st.o
|
||||||
st
|
st
|
||||||
|
x.o
|
||||||
config.h
|
config.h
|
||||||
*.o
|
|
||||||
*.orig
|
*.orig
|
||||||
*.rej
|
*.rej
|
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
SRC = st.c x.c colors.c
|
SRC = st.c x.c
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
all: st
|
all: st
|
||||||
|
|
39
colors.c
39
colors.c
|
@ -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);
|
|
||||||
}
|
|
2
colors.h
2
colors.h
|
@ -1,2 +0,0 @@
|
||||||
|
|
||||||
void colorpywal(void);
|
|
|
@ -97,7 +97,7 @@ unsigned int tabspaces = 8;
|
||||||
float alpha = 0.8;
|
float alpha = 0.8;
|
||||||
|
|
||||||
/* Terminal colors (16 first used in escape sequence) */
|
/* Terminal colors (16 first used in escape sequence) */
|
||||||
char *colorname[] = {
|
static const char *colorname[] = {
|
||||||
/* 8 normal colors */
|
/* 8 normal colors */
|
||||||
"black",
|
"black",
|
||||||
"red3",
|
"red3",
|
||||||
|
|
1
st.c
1
st.c
|
@ -1360,7 +1360,6 @@ tdeleteline(int n)
|
||||||
tscrollup(term.c.y, n, 0);
|
tscrollup(term.c.y, n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
tdefcolor(const int *attr, int *npar, int l)
|
tdefcolor(const int *attr, int *npar, int l)
|
||||||
{
|
{
|
||||||
|
|
2
x.c
2
x.c
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
char *argv0;
|
char *argv0;
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
#include "colors.h"
|
|
||||||
#include "st.h"
|
#include "st.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
|
@ -772,7 +771,6 @@ sixd_to_16bit(int x)
|
||||||
int
|
int
|
||||||
xloadcolor(int i, const char *name, Color *ncolor)
|
xloadcolor(int i, const char *name, Color *ncolor)
|
||||||
{
|
{
|
||||||
colorpywal();
|
|
||||||
XRenderColor color = { .alpha = 0xffff };
|
XRenderColor color = { .alpha = 0xffff };
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
|
Loading…
Reference in a new issue