diff options
author | John Collis <john.collis@alliedtelesis.co.nz> | 2020-09-06 17:53:41 +1200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-10-18 11:17:11 +0200 |
commit | 28b4c822c5c0acec300fdf15c6e3ede9f5e2335d (patch) | |
tree | b2af1c27a64169cfd7a8807c207d07a6c429bd6c | |
parent | fa253f077f19b3220c7655b81bd91e52f4367803 (diff) | |
download | st-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.c | 9 | ||||
-rw-r--r-- | win.h | 1 | ||||
-rw-r--r-- | x.c | 16 |
3 files changed, 25 insertions, 1 deletions
@@ -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]); |
@@ -30,6 +30,7 @@ void xdrawline(Line, int, int, int); | |||
30 | void xfinishdraw(void); | 30 | void xfinishdraw(void); |
31 | void xloadcols(void); | 31 | void xloadcols(void); |
32 | int xsetcolorname(int, const char *); | 32 | int xsetcolorname(int, const char *); |
33 | void xseticontitle(char *); | ||
33 | void xsettitle(char *); | 34 | void xsettitle(char *); |
34 | int xsetcursor(int); | 35 | int xsetcursor(int); |
35 | void xsetmode(int, unsigned int); | 36 | void xsetmode(int, unsigned int); |
@@ -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 | ||
1582 | void | 1583 | void |
1584 | xseticontitle(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 | |||
1596 | void | ||
1583 | xsettitle(char *p) | 1597 | xsettitle(char *p) |
1584 | { | 1598 | { |
1585 | XTextProperty prop; | 1599 | XTextProperty prop; |