summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ratpoison.12
-rw-r--r--doc/ratpoison.texi2
-rw-r--r--src/format.c14
3 files changed, 18 insertions, 0 deletions
diff --git a/doc/ratpoison.1 b/doc/ratpoison.1
index c1cfc6d..d953965 100644
--- a/doc/ratpoison.1
+++ b/doc/ratpoison.1
@@ -660,6 +660,8 @@ The following substitutions happen in format:
.br
%i by the X Window ID,
.br
+%p by the process ID,
+.br
%l by the last access number,
.br
%M by the string \fBMaxsize\fP, if it specifies a maximum size,
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 788c7f0..75a5e7a 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -386,6 +386,8 @@ A unique number based on when the window was last accessed. The higher
the number, the more recently it was accessed.
@item %n
The window number
+@item %p
+Process ID ('?' if _NET_WM_PID isn't set)
@item %s
Window status (current window, last window, etc)
@item %S
diff --git a/src/format.c b/src/format.c
index a5bbd64..0706f21 100644
--- a/src/format.c
+++ b/src/format.c
@@ -44,6 +44,7 @@ RP_FMT(screen);
RP_FMT(xinescreen);
RP_FMT(transient);
RP_FMT(maxsize);
+RP_FMT(pid);
struct fmt_item {
/* The format character */
@@ -63,6 +64,7 @@ struct fmt_item fmt_items[] = {
{ 'i', fmt_windowid },
{ 'l', fmt_lastaccess },
{ 'n', fmt_number },
+ { 'p', fmt_pid },
{ 's', fmt_status },
{ 'S', fmt_screen },
{ 't', fmt_name },
@@ -298,3 +300,15 @@ fmt_maxsize (rp_window_elem *elem, struct sbuf *buf)
if (elem->win->hints->flags & PMaxSize)
sbuf_concat (buf, "Maxsize");
}
+
+static void
+fmt_pid (rp_window_elem *elem, struct sbuf *buf)
+{
+ struct rp_child_info *info;
+
+ info = get_child_info (elem->win->w);
+ if (info)
+ sbuf_printf_concat (buf, "%d", info->pid);
+ else
+ sbuf_concat (buf, "?");
+}