]> git.armaanb.net Git - st.git/blobdiff - x.c
ST: Add WM_ICON_NAME property support
[st.git] / x.c
diff --git a/x.c b/x.c
index 210f184a31f3a8a83705f44d9c1ce0432deb38fa..120e495df49c650856251a785e9716acf90d6a39 100644 (file)
--- a/x.c
+++ b/x.c
@@ -93,7 +93,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;
@@ -1186,6 +1186,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);
@@ -1579,6 +1580,19 @@ xsetenv(void)
        setenv("WINDOWID", buf, 1);
 }
 
+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)
 {