commit 29b20b54c5c416638f2e7c205705a00c4ac9a57a
parent 835d204593499d438a49eb03b60e7f48a8f7c316
Author: bakkeby <bakkeby@gmail.com>
Date: Mon, 10 May 2021 09:28:15 +0200
ST: Add WM_ICON_NAME property support
Also added _NET_WM_ICON_NAME.
https://git.suckless.org/st/commit/28b4c822c5c0acec300fdf15c6e3ede9f5e2335d.html#h0-1-11
https://git.suckless.org/st/commit/4ef0cbd8b9371f37f7d02ef37b5378b879e6b8bf.html#h0-0-3
Diffstat:
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/st.c b/st.c
@@ -2363,7 +2363,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/st.h b/st.h
@@ -196,7 +196,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;
#if NETWMICON_PATCH
Atom netwmicon;
#endif // NETWMICON_PATCH
diff --git a/win.h b/win.h
@@ -40,6 +40,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
@@ -1424,6 +1424,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);
#if NETWMICON_PATCH
@@ -2142,6 +2143,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;