old patches removed
This commit is contained in:
parent
ffe6670fe2
commit
075f8eee4a
17
README.md
17
README.md
|
@ -30,20 +30,3 @@ sudo make install
|
|||
```
|
||||
|
||||
Obviously, `make` is required to build. `fontconfig` is required for the default build, since it asks `fontconfig` for your system monospace font. It might be obvious, but `libX11` and `libXft` are required as well. Chances are, you have all of this installed already.
|
||||
|
||||
## Custom changes (`config.def.h` or `config.h`)
|
||||
|
||||
Now by default, the terminal is transparent and uses an Xresources patch that
|
||||
looks for your Xresources colors for the colors of st. You can disable the
|
||||
Xresources patch by reversing it as below:
|
||||
|
||||
```
|
||||
patch -R < xresources.patch
|
||||
```
|
||||
|
||||
On top of that, you can disable alpha and enable fully solarized colors by
|
||||
running the following:
|
||||
|
||||
```
|
||||
patch < solarized-alpha-toggle.patch
|
||||
```
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
--- config.h 2018-05-01 14:09:36.752813283 -0700
|
||||
+++ config.sol.h 2018-05-01 14:10:20.132810913 -0700
|
||||
@@ -83,7 +83,7 @@
|
||||
unsigned int tabspaces = 8;
|
||||
|
||||
/* bg opacity */
|
||||
-unsigned int alpha = 0xcd;
|
||||
+unsigned int alpha = 0xff;
|
||||
|
||||
static const char *colorname[] = {
|
||||
"#073642", /* 0: black */
|
||||
@@ -114,7 +114,7 @@
|
||||
* foreground, background, cursor, reverse cursor
|
||||
*/
|
||||
unsigned int defaultfg = 12;
|
||||
-unsigned int defaultbg = 256;
|
||||
+unsigned int defaultbg = 0;
|
||||
static unsigned int defaultcs = 14;
|
||||
static unsigned int defaultrcs = 15;
|
||||
|
183
xresources.patch
183
xresources.patch
|
@ -1,183 +0,0 @@
|
|||
From 9ba79c106145759de6b436dac2e4b8ff5a12bc2e Mon Sep 17 00:00:00 2001
|
||||
From: "Devin J. Pohly" <djpohly@gmail.com>
|
||||
Date: Fri, 9 Mar 2018 14:56:34 -0600
|
||||
Subject: [PATCH] Port Xresources patch by @dcat to st-git
|
||||
|
||||
---
|
||||
config.h | 35 +++++++++++++++++++++++++++
|
||||
x.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 109 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/config.h b/config.h
|
||||
index 82b1b09..471fe57 100644
|
||||
--- a/config.h
|
||||
+++ b/config.h
|
||||
@@ -150,6 +150,41 @@ static unsigned int mousebg = 0;
|
||||
*/
|
||||
static unsigned int defaultattr = 11;
|
||||
|
||||
+/*
|
||||
+ * 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[256] },
|
||||
+ { "foreground", STRING, &colorname[257] },
|
||||
+ { "cursorColor", STRING, &colorname[258] },
|
||||
+ { "termname", STRING, &termname },
|
||||
+ { "shell", STRING, &shell },
|
||||
+ { "xfps", INTEGER, &xfps },
|
||||
+ { "actionfps", INTEGER, &actionfps },
|
||||
+ { "blinktimeout", INTEGER, &blinktimeout },
|
||||
+ { "bellvolume", INTEGER, &bellvolume },
|
||||
+ { "tabspaces", INTEGER, &tabspaces },
|
||||
+ { "cwscale", FLOAT, &cwscale },
|
||||
+ { "chscale", FLOAT, &chscale },
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* Internal mouse shortcuts.
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
diff --git a/x.c b/x.c
|
||||
index d43a529..7f29cc2 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <X11/XKBlib.h>
|
||||
+#include <X11/Xresource.h>
|
||||
|
||||
static char *argv0;
|
||||
#include "arg.h"
|
||||
@@ -43,6 +44,19 @@ typedef struct {
|
||||
signed char appcursor; /* application cursor */
|
||||
} Key;
|
||||
|
||||
+/* Xresources preferences */
|
||||
+enum resource_type {
|
||||
+ STRING = 0,
|
||||
+ INTEGER = 1,
|
||||
+ FLOAT = 2
|
||||
+};
|
||||
+
|
||||
+typedef struct {
|
||||
+ char *name;
|
||||
+ enum resource_type type;
|
||||
+ void *dst;
|
||||
+} ResourcePref;
|
||||
+
|
||||
/* X modifiers */
|
||||
#define XK_ANY_MOD UINT_MAX
|
||||
#define XK_NO_MOD 0
|
||||
@@ -778,8 +792,8 @@ xclear(int x1, int y1, int x2, int y2)
|
||||
void
|
||||
xhints(void)
|
||||
{
|
||||
- XClassHint class = {opt_name ? opt_name : termname,
|
||||
- opt_class ? opt_class : termname};
|
||||
+ XClassHint class = {opt_name ? opt_name : "st",
|
||||
+ opt_class ? opt_class : "St"};
|
||||
XWMHints wm = {.flags = InputHint, .input = 1};
|
||||
XSizeHints *sizeh;
|
||||
|
||||
@@ -999,8 +1013,6 @@ xinit(int cols, int rows)
|
||||
pid_t thispid = getpid();
|
||||
XColor xmousefg, xmousebg;
|
||||
|
||||
- if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||
- die("Can't open display\n");
|
||||
xw.scr = XDefaultScreen(xw.dpy);
|
||||
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
|
||||
|
||||
@@ -1864,6 +1876,59 @@ run(void)
|
||||
}
|
||||
}
|
||||
|
||||
+int
|
||||
+resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
||||
+{
|
||||
+ char **sdst = dst;
|
||||
+ int *idst = dst;
|
||||
+ float *fdst = dst;
|
||||
+
|
||||
+ char fullname[256];
|
||||
+ char fullclass[256];
|
||||
+ char *type;
|
||||
+ XrmValue ret;
|
||||
+
|
||||
+ snprintf(fullname, sizeof(fullname), "%s.%s",
|
||||
+ opt_name ? opt_name : "st", name);
|
||||
+ snprintf(fullclass, sizeof(fullclass), "%s.%s",
|
||||
+ opt_class ? opt_class : "St", name);
|
||||
+ fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0';
|
||||
+
|
||||
+ XrmGetResource(db, fullname, fullclass, &type, &ret);
|
||||
+ if (ret.addr == NULL || strncmp("String", type, 64))
|
||||
+ return 1;
|
||||
+
|
||||
+ switch (rtype) {
|
||||
+ case STRING:
|
||||
+ *sdst = ret.addr;
|
||||
+ break;
|
||||
+ case INTEGER:
|
||||
+ *idst = strtoul(ret.addr, NULL, 10);
|
||||
+ break;
|
||||
+ case FLOAT:
|
||||
+ *fdst = strtof(ret.addr, NULL);
|
||||
+ break;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+config_init(void)
|
||||
+{
|
||||
+ char *resm;
|
||||
+ XrmDatabase db;
|
||||
+ ResourcePref *p;
|
||||
+
|
||||
+ XrmInitialize();
|
||||
+ resm = XResourceManagerString(xw.dpy);
|
||||
+ if (!resm)
|
||||
+ return;
|
||||
+
|
||||
+ db = XrmGetStringDatabase(resm);
|
||||
+ for (p = resources; p < resources + LEN(resources); p++)
|
||||
+ resource_load(db, p->name, p->type, p->dst);
|
||||
+}
|
||||
+
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
@@ -1937,6 +2002,11 @@ run:
|
||||
}
|
||||
setlocale(LC_CTYPE, "");
|
||||
XSetLocaleModifiers("");
|
||||
+
|
||||
+ if(!(xw.dpy = XOpenDisplay(NULL)))
|
||||
+ die("Can't open display\n");
|
||||
+
|
||||
+ config_init();
|
||||
cols = MAX(cols, 1);
|
||||
rows = MAX(rows, 1);
|
||||
tnew(cols, rows);
|
||||
--
|
||||
2.16.2
|
||||
|
Loading…
Reference in New Issue
Block a user