summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-22 19:01:47 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-22 19:01:47 +0100
commit7be39e0c723c88fb9b55bd1235d4e828eb34921c (patch)
treec78cc7252dbc3719e38ce7e80de1b17273165584
parent6118bd9fb7c47139efe9aa8a0f46ce0ab5eb3456 (diff)
parent4ef0cbd8b9371f37f7d02ef37b5378b879e6b8bf (diff)
downloadst-7be39e0c723c88fb9b55bd1235d4e828eb34921c.tar.gz
st-7be39e0c723c88fb9b55bd1235d4e828eb34921c.tar.bz2
st-7be39e0c723c88fb9b55bd1235d4e828eb34921c.zip
Merge branch 'master' of git://git.suckless.org/st
-rw-r--r--st.c8
-rw-r--r--win.h1
-rw-r--r--x.c16
3 files changed, 24 insertions, 1 deletions
diff --git a/st.c b/st.c
index ea13c13..19374d7 100644
--- a/st.c
+++ b/st.c
@@ -1915,7 +1915,15 @@ strhandle(void)
case ']': /* OSC -- Operating System Command */
switch (par) {
case 0:
+ if (narg > 1) {
+ xsettitle(strescseq.args[1]);
+ xseticontitle(strescseq.args[1]);
+ }
+ return;
case 1:
+ if (narg > 1)
+ xseticontitle(strescseq.args[1]);
+ return;
case 2:
if (narg > 1)
xsettitle(strescseq.args[1]);
diff --git a/win.h b/win.h
index bc0d180..8b5b618 100644
--- a/win.h
+++ b/win.h
@@ -30,6 +30,7 @@ void xdrawline(Line, int, int, int);
void xfinishdraw(void);
void xloadcols(void);
int xsetcolorname(int, const char *);
+void xseticontitle(char *);
void xsettitle(char *);
int xsetcursor(int);
void xsetmode(int, unsigned int);
diff --git a/x.c b/x.c
index 59c11b8..f81b8ca 100644
--- a/x.c
+++ b/x.c
@@ -94,7 +94,7 @@ typedef struct {
Window win;
Drawable buf;
GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
- Atom xembed, wmdeletewin, netwmname, netwmpid;
+ Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid;
struct {
XIM xim;
XIC xic;
@@ -1291,6 +1291,7 @@ xinit(int cols, int rows)
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False);
+ xw.netwmiconname = XInternAtom(xw.dpy, "_NET_WM_ICON_NAME", False);
XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False);
@@ -1691,6 +1692,19 @@ xsetenv(void)
}
void
+xseticontitle(char *p)
+{
+ XTextProperty prop;
+ DEFAULT(p, opt_title);
+
+ Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop);
+ XSetWMIconName(xw.dpy, xw.win, &prop);
+ XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmiconname);
+ XFree(prop.value);
+}
+
+void
xsettitle(char *p)
{
XTextProperty prop;