summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormackarelfish <mackarelfish93@gmail.com>2020-05-31 10:23:03 +0700
committermackarelfish <mackarelfish93@gmail.com>2020-05-31 10:23:03 +0700
commit6bf7545fc98cd0d42eb727d596215daac809c478 (patch)
tree1dd49c4a4819f4c4f22a09d9d36a5a129e7a6ceb
parent4edc7282ab841142e970dcb4f03f251bb5ed7292 (diff)
parent22c71c355ca4f4e965c3d07e9ac37b0da7349255 (diff)
Merge branch 'master' of https://github.com/lukesmithxyz/st
-rw-r--r--README.md2
-rw-r--r--config.h4
-rw-r--r--config.mk4
-rw-r--r--st.c19
-rw-r--r--st.h1
-rw-r--r--win.h1
-rw-r--r--x.c9
7 files changed, 34 insertions, 6 deletions
diff --git a/README.md b/README.md
index 95238b6..811f446 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ Obviously, `make` is required to build. `fontconfig` is required for the default
On OpenBSD, be sure to edit `config.mk` first and remove `-lrt` from the `$LIBS` before compiling.
-Be sure to have a composite manager (`xcompmgr`, `compton`, etc.) running if you want transparency.
+Be sure to have a composite manager (`xcompmgr`, `picom`, etc.) running if you want transparency.
## How to configure dynamically with Xresources
diff --git a/config.h b/config.h
index 696f634..c8921bd 100644
--- a/config.h
+++ b/config.h
@@ -143,8 +143,8 @@ static const char *colorname[] = {
*/
unsigned int defaultfg = 259;
unsigned int defaultbg = 258;
-static unsigned int defaultcs = 256;
-static unsigned int defaultrcs = 257;
+unsigned int defaultcs = 256;
+unsigned int defaultrcs = 257;
/*
* Default shape of cursor
diff --git a/config.mk b/config.mk
index 8c67771..dcf5706 100644
--- a/config.mk
+++ b/config.mk
@@ -10,6 +10,10 @@ MANPREFIX = $(PREFIX)/share/man
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
+# include X11 in Ubuntu
+# X11INC = /usr/include/X11R6
+# X11LIB = /usr/lib/X11R6
+
PKG_CONFIG = pkg-config
# includes and libs
diff --git a/st.c b/st.c
index c4d3ee3..9ac8501 100644
--- a/st.c
+++ b/st.c
@@ -1943,12 +1943,23 @@ strhandle(void)
}
return;
case 4: /* color set */
- if (narg < 3)
+ case 10: /* foreground set */
+ case 11: /* background set */
+ case 12: /* cursor color */
+ if ((par == 4 && narg < 3) || narg < 2)
break;
- p = strescseq.args[2];
+ p = strescseq.args[((par == 4) ? 2 : 1)];
/* FALLTHROUGH */
case 104: /* color reset, here p = NULL */
- j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
+ if (par == 10)
+ j = defaultfg;
+ else if (par == 11)
+ j = defaultbg;
+ else if (par == 12)
+ j = defaultcs;
+ else
+ j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
+
if (xsetcolorname(j, p)) {
if (par == 104 && narg <= 1)
return; /* color reset without parameter */
@@ -1959,6 +1970,8 @@ strhandle(void)
* TODO if defaultbg color is changed, borders
* are dirty
*/
+ if (j == defaultbg)
+ xclearwin();
redraw();
}
return;
diff --git a/st.h b/st.h
index a998945..d5a63e7 100644
--- a/st.h
+++ b/st.h
@@ -142,6 +142,7 @@ extern char *termname;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
+extern unsigned int defaultcs;
extern const int boxdraw, boxdraw_bold, boxdraw_braille;
extern float alpha;
extern MouseKey mkeys[];
diff --git a/win.h b/win.h
index bc0d180..aa7ff76 100644
--- a/win.h
+++ b/win.h
@@ -37,3 +37,4 @@ void xsetpointermotion(int);
void xsetsel(char *);
int xstartdraw(void);
void xximspot(int, int);
+void xclearwin(void);
diff --git a/x.c b/x.c
index e7c9001..e91edbf 100644
--- a/x.c
+++ b/x.c
@@ -815,6 +815,8 @@ xsetcolorname(int x, const char *name)
XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]);
dc.col[x] = ncolor;
+ if (x == defaultbg)
+ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
return 0;
}
@@ -831,6 +833,13 @@ xclear(int x1, int y1, int x2, int y2)
}
void
+xclearwin(void)
+{
+ xclear(0, 0, win.w, win.h);
+}
+
+
+void
xhints(void)
{
XClassHint class = {opt_name ? opt_name : "st",