pywal icon indicating copy to clipboard operation
pywal copied to clipboard

st with xresources patch: everything updates as expected except the background

Open ghost opened this issue 5 years ago • 3 comments

Hi, I'm using st with the xresources patch and everything is working as expected except the background which changes ONLY after I spawn a new instance of st, rather than on the fly like everything else. Here is the relevant code in my st

/*
 * Default colors (colorname index)
 * foreground, background, cursor, reverse cursor
 */
unsigned int defaultfg = 259;
unsigned int defaultbg = 258;
static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;

and

/*
 * Xresources preferences to load at startup
 */
ResourcePref resources[] = {
		{ "font",         STRING,  &font },
		{ "color0",       STRING,  &colorname[0] },
		{ "color1",       STRING,  &colorname[1] },
		{ "color2",       STRING,  &colorname[2] },
		{ "color3",       STRING,  &colorname[3] },
		{ "color4",       STRING,  &colorname[4] },
		{ "color5",       STRING,  &colorname[5] },
		{ "color6",       STRING,  &colorname[6] },
		{ "color7",       STRING,  &colorname[7] },
		{ "color8",       STRING,  &colorname[8] },
		{ "color9",       STRING,  &colorname[9] },
		{ "color10",      STRING,  &colorname[10] },
		{ "color11",      STRING,  &colorname[11] },
		{ "color12",      STRING,  &colorname[12] },
		{ "color13",      STRING,  &colorname[13] },
		{ "color14",      STRING,  &colorname[14] },
		{ "color15",      STRING,  &colorname[15] },
		{ "background",   STRING,  &colorname[258] },
		{ "foreground",   STRING,  &colorname[259] },
		{ "cursorColor",  STRING,  &colorname[256] },
		{ "termname",     STRING,  &termname },
		{ "shell",        STRING,  &shell },
		{ "xfps",         INTEGER, &xfps },
		{ "actionfps",    INTEGER, &actionfps },
		{ "blinktimeout", INTEGER, &blinktimeout },
		{ "bellvolume",   INTEGER, &bellvolume },
		{ "tabspaces",    INTEGER, &tabspaces },
		{ "cwscale",      FLOAT,   &cwscale },
		{ "alpha",        FLOAT,   &alpha },
		{ "chscale",      FLOAT,   &chscale },
};

ghost avatar Apr 16 '20 09:04 ghost

I believe your issue is the defaultbg value. not sure what 258 is, but the wal-generated background is 0 and foreground is 7 for off-white and 15 for white. This should sort you out:

/*
 * Default colors (colorname index)
 * foreground, background, cursor, reverse cursor
 */
unsigned int defaultfg = 15;
unsigned int defaultbg = 0;
static unsigned int defaultcs = 15;
static unsigned int defaultrcs = 0;

iofq avatar May 17 '20 21:05 iofq

I believe your issue is the defaultbg value. not sure what 258 is, but the wal-generated background is 0 and foreground is 7 for off-white and 15 for white. This should sort you out:

/*
 * Default colors (colorname index)
 * foreground, background, cursor, reverse cursor
 */
unsigned int defaultfg = 15;
unsigned int defaultbg = 0;
static unsigned int defaultcs = 15;
static unsigned int defaultrcs = 0;

That worked great. However, This makes new instances of st non-transparent. New instances of st are transparent but when I run wal all existing st instances stop being transparent.

The transparency of st is determined by *.alpha: 0.92 line in .Xresources.

ghost avatar May 30 '20 14:05 ghost

I was able to resolve this issue by using the -s option with pywal, and replacing the "xresources" patch with xresources with reload signal/. After doing this just add pidof st | xargs kill -s USR1 to the script you run with -o and it should work fine.

aflyingpumpkin avatar Oct 28 '22 20:10 aflyingpumpkin