aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Collis <john.collis@alliedtelesis.co.nz>2020-09-06 17:53:41 +1200
committerHiltjo Posthuma <hiltjo@codemadness.org>2020-10-18 11:17:11 +0200
commit28b4c822c5c0acec300fdf15c6e3ede9f5e2335d (patch)
treeb2af1c27a64169cfd7a8807c207d07a6c429bd6c
parentfa253f077f19b3220c7655b81bd91e52f4367803 (diff)
downloadst-patched-28b4c822c5c0acec300fdf15c6e3ede9f5e2335d.tar.bz2
st-patched-28b4c822c5c0acec300fdf15c6e3ede9f5e2335d.tar.xz
st-patched-28b4c822c5c0acec300fdf15c6e3ede9f5e2335d.zip
ST: Add WM_ICON_NAME property support
Also added _NET_WM_ICON_NAME.
-rw-r--r--st.c9
-rw-r--r--win.h1
-rw-r--r--x.c16
3 files changed, 25 insertions, 1 deletions
diff --git a/st.c b/st.c
index 76b7e0d..ae7fa63 100644
--- a/st.c
+++ b/st.c
@@ -1844,6 +1844,7 @@ strhandle(void)
1844{ 1844{
1845 char *p = NULL, *dec; 1845 char *p = NULL, *dec;
1846 int j, narg, par; 1846 int j, narg, par;
1847 static int winname = 0;
1847 1848
1848 term.esc &= ~(ESC_STR_END|ESC_STR); 1849 term.esc &= ~(ESC_STR_END|ESC_STR);
1849 strparse(); 1850 strparse();
@@ -1853,7 +1854,15 @@ strhandle(void)
1853 case ']': /* OSC -- Operating System Command */ 1854 case ']': /* OSC -- Operating System Command */
1854 switch (par) { 1855 switch (par) {
1855 case 0: 1856 case 0:
1857 if (narg > 1) {
1858 xsettitle(strescseq.args[1]);
1859 xseticontitle(strescseq.args[1]);
1860 }
1861 return;
1856 case 1: 1862 case 1:
1863 if (narg > 1)
1864 xseticontitle(strescseq.args[1]);
1865 return;
1857 case 2: 1866 case 2:
1858 if (narg > 1) 1867 if (narg > 1)
1859 xsettitle(strescseq.args[1]); 1868 xsettitle(strescseq.args[1]);
diff --git a/win.h b/win.h
index a6ef1b9..e6e4369 100644
--- a/win.h
+++ b/win.h
@@ -30,6 +30,7 @@ void xdrawline(Line, int, int, int);
30void xfinishdraw(void); 30void xfinishdraw(void);
31void xloadcols(void); 31void xloadcols(void);
32int xsetcolorname(int, const char *); 32int xsetcolorname(int, const char *);
33void xseticontitle(char *);
33void xsettitle(char *); 34void xsettitle(char *);
34int xsetcursor(int); 35int xsetcursor(int);
35void xsetmode(int, unsigned int); 36void xsetmode(int, unsigned int);
diff --git a/x.c b/x.c
index 210f184..120e495 100644
--- a/x.c
+++ b/x.c
@@ -93,7 +93,7 @@ typedef struct {
93 Window win; 93 Window win;
94 Drawable buf; 94 Drawable buf;
95 GlyphFontSpec *specbuf; /* font spec buffer used for rendering */ 95 GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
96 Atom xembed, wmdeletewin, netwmname, netwmpid; 96 Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid;
97 struct { 97 struct {
98 XIM xim; 98 XIM xim;
99 XIC xic; 99 XIC xic;
@@ -1186,6 +1186,7 @@ xinit(int cols, int rows)
1186 xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); 1186 xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
1187 xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); 1187 xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
1188 xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False); 1188 xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False);
1189 xw.netwmiconname = XInternAtom(xw.dpy, "_NET_WM_ICON_NAME", False);
1189 XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1); 1190 XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
1190 1191
1191 xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False); 1192 xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False);
@@ -1580,6 +1581,19 @@ xsetenv(void)
1580} 1581}
1581 1582
1582void 1583void
1584xseticontitle(char *p)
1585{
1586 XTextProperty prop;
1587 DEFAULT(p, opt_title);
1588
1589 Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
1590 &prop);
1591 XSetWMIconName(xw.dpy, xw.win, &prop);
1592 XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmiconname);
1593 XFree(prop.value);
1594}
1595
1596void
1583xsettitle(char *p) 1597xsettitle(char *p)
1584{ 1598{
1585 XTextProperty prop; 1599 XTextProperty prop;