diff options
author | Antti Nykänen <aon@iki.fi> | 2008-06-26 16:57:16 +0300 |
---|---|---|
committer | Shawn <sabetts@juicebox.(none)> | 2008-10-12 17:29:27 -0700 |
commit | 9ec3e80ad828e3eb35ce800b78fa73176d0d7c02 (patch) | |
tree | 5c9888f9b7e32744a4c88c39bc9a833765e47137 /src | |
parent | 656481bd1b052137826d041347bd0a93592b96a0 (diff) | |
download | ratpoison-9ec3e80ad828e3eb35ce800b78fa73176d0d7c02.zip |
PID support for format_string
Diffstat (limited to 'src')
-rw-r--r-- | src/format.c | 14 |
1 files changed, 14 insertions, 0 deletions
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, "?"); +} |