Remove the vtcolors patch ref. #262

vertigo
bakkeby 2 years ago
parent 5fefbfee64
commit baef26402f

@ -305,22 +305,6 @@ static const unsigned int alphas[][3] = {
#endif // BAR_FLEXWINTITLE_PATCH
};
#endif // BAR_ALPHA_PATCH
#if BAR_VTCOLORS_PATCH
static const char title_bg_dark[] = "#303030";
static const char title_bg_light[] = "#fdfdfd";
static const int color_ptrs[][ColCount] = {
/* fg bg border float */
[SchemeNorm] = { -1, -1, 5, 12 },
[SchemeSel] = { -1, -1, 11, 13 },
[SchemeTitleNorm] = { 6, -1, -1, -1 },
[SchemeTitleSel] = { 6, -1, -1, -1 },
[SchemeTagsNorm] = { 2, 0, 0, -1 },
[SchemeTagsSel] = { 6, 5, 5, -1 },
[SchemeHidNorm] = { 5, 0, 0, -1 },
[SchemeHidSel] = { 6, -1, -1, -1 },
[SchemeUrg] = { 7, 9, 9, 15 },
};
#endif // BAR_VTCOLORS_PATCH
static char *colors[][ColCount] = {
/* fg bg border float */

@ -1,69 +0,0 @@
void
get_vt_colors(void)
{
char *cfs[3] = {
"/sys/module/vt/parameters/default_red",
"/sys/module/vt/parameters/default_grn",
"/sys/module/vt/parameters/default_blu",
};
char vtcs[16][8];
char tk[] = ",";
char cl[64];
char *tp = NULL;
FILE *fp;
size_t r;
int i, c, n, len;
for (i = 0; i < 16; i++)
strcpy(vtcs[i], "#000000");
for (i = 0, r = 0; i < 3; i++) {
if ((fp = fopen(cfs[i], "r")) == NULL)
continue;
while ((cl[r] = fgetc(fp)) != EOF && cl[r] != '\n')
r++;
cl[r] = '\0';
for (c = 0, tp = cl, n = 0; c < 16; c++, tp++) {
if ((r = strcspn(tp, tk)) == -1)
break;
for (n = 0; r && *tp >= 48 && *tp < 58; r--, tp++)
n = n * 10 - 48 + *tp;
vtcs[c][i * 2 + 1] = n / 16 < 10 ? n / 16 + 48 : n / 16 + 87;
vtcs[c][i * 2 + 2] = n % 16 < 10 ? n % 16 + 48 : n % 16 + 87;
}
fclose(fp);
}
len = LENGTH(colors);
if (len > LENGTH(color_ptrs))
len = LENGTH(color_ptrs);
for (i = 0; i < len; i++) {
for (c = 0; c < ColCount; c++) {
n = color_ptrs[i][c];
if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
memcpy(colors[i][c], vtcs[n], 7);
}
}
}
int get_luminance(char *r)
{
char *c = r;
int n[3] = {0};
int i = 0;
while (*c) {
if (*c >= 48 && *c < 58)
n[i / 2] = n[i / 2] * 16 - 48 + *c;
else if (*c >= 65 && *c < 71)
n[i / 2] = n[i / 2] * 16 - 55 + *c;
else if (*c >= 97 && *c < 103)
n[i / 2] = n[i / 2] * 16 - 87 + *c;
else
i--;
i++;
c++;
}
return (0.299 * n[0] + 0.587 * n[1] + 0.114 * n[2]) / 2.55;
}

@ -1,3 +0,0 @@
static void get_vt_colors(void);
static int get_luminance(char *rgb);

@ -87,9 +87,6 @@
#if BAR_HOLDBAR_PATCH
#include "bar_holdbar.c"
#endif
#if BAR_VTCOLORS_PATCH
#include "bar_vtcolors.c"
#endif
#if BAR_WINTITLEACTIONS_PATCH
#include "bar_wintitleactions.c"
#endif

@ -87,9 +87,6 @@
#if BAR_SYSTRAY_PATCH
#include "bar_systray.h"
#endif
#if BAR_VTCOLORS_PATCH
#include "bar_vtcolors.h"
#endif
#if BAR_WINTITLEACTIONS_PATCH
#include "bar_wintitleactions.h"
#endif

@ -418,13 +418,6 @@
*/
#define BAR_STATUSPADDING_PATCH 0
/* This patch adds the ability for dwm to read colors from the linux virtual console.
* /sys/module/vt/parameters/default_{red,grn,blu}
* Essentially this way the colors you use in your regular tty is "mirrored" to dwm.
* https://dwm.suckless.org/patches/vtcolors/
*/
#define BAR_VTCOLORS_PATCH 0
/* This patch allows client windows to be hidden. This code was originally part of awesomebar,
* but has been separated out so that other bar modules can take advantage of it.
* Both awesomebar and bartabgroups patches depend on this patch and it will be auto-enabled

Loading…
Cancel
Save