summaryrefslogtreecommitdiffstats
path: root/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'format.c')
-rw-r--r--format.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/format.c b/format.c
index 0cf7ee64..45479d5e 100644
--- a/format.c
+++ b/format.c
@@ -576,7 +576,7 @@ format_cb_current_command(struct format_tree *ft, struct format_entry *fe)
if (wp == NULL)
return;
- cmd = get_proc_name(wp->fd, wp->tty);
+ cmd = osdep_get_name(wp->fd, wp->tty);
if (cmd == NULL || *cmd == '\0') {
free(cmd);
cmd = cmd_stringify_argv(wp->argc, wp->argv);
@@ -589,6 +589,21 @@ format_cb_current_command(struct format_tree *ft, struct format_entry *fe)
free(cmd);
}
+/* Callback for pane_current_path. */
+static void
+format_cb_current_path(struct format_tree *ft, struct format_entry *fe)
+{
+ struct window_pane *wp = ft->wp;
+ char *cwd;
+
+ if (wp == NULL)
+ return;
+
+ cwd = osdep_get_cwd(wp->fd);
+ if (cwd != NULL)
+ fe->value = xstrdup(cwd);
+}
+
/* Callback for history_bytes. */
static void
format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe)
@@ -884,6 +899,7 @@ format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
ft->flags = flags;
ft->time = time(NULL);
+ format_add(ft, "version", "%s", VERSION);
format_add_cb(ft, "host", format_cb_host);
format_add_cb(ft, "host_short", format_cb_host_short);
format_add_cb(ft, "pid", format_cb_pid);
@@ -2249,6 +2265,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_pid", "%ld", (long) wp->pid);
format_add_cb(ft, "pane_start_command", format_cb_start_command);
format_add_cb(ft, "pane_current_command", format_cb_current_command);
+ format_add_cb(ft, "pane_current_path", format_cb_current_path);
format_add(ft, "cursor_x", "%u", wp->base.cx);
format_add(ft, "cursor_y", "%u", wp->base.cy);