Commit 3c7151f7 authored by Klee Dienes's avatar Klee Dienes
Browse files

Add support for _NET_WM_PID

parent fd898918
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -311,15 +311,21 @@ void winwidget_create_window(winwidget ret, int w, int h)
void winwidget_update_title(winwidget ret)
{
	char *name;
	pid_t pid;
	Atom prop_name = XInternAtom(disp, "_NET_WM_NAME", False);
	Atom prop_pid = XInternAtom(disp, "_NET_WM_PID", False);
	Atom prop_icon = XInternAtom(disp, "_NET_WM_ICON_NAME", False);
	Atom prop_utf8 = XInternAtom(disp, "UTF8_STRING", False);

	D(("winwid->name = %s\n", ret->name));
	name = ret->name ? ret->name : "feh";
	pid = getpid();
	XStoreName(disp, ret->win, name);
	XSetIconName(disp, ret->win, name);

	XChangeProperty(disp, ret->win, prop_pid, XA_CARDINAL, sizeof(pid_t) * 8,
			PropModeReplace, (const unsigned char *)&pid, 1);

	XChangeProperty(disp, ret->win, prop_name, prop_utf8, 8,
			PropModeReplace, (const unsigned char *)name, strlen(name));