diff options
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 41 |
1 files changed, 26 insertions, 15 deletions
@@ -521,7 +521,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); @@ -534,6 +534,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) @@ -646,6 +661,7 @@ format_create(struct client *c, struct cmdq_item *item, int tag, int flags) ft->tag = tag; ft->flags = flags; + 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); @@ -1346,8 +1362,6 @@ format_defaults_session(struct format_tree *ft, struct session *s) format_add(ft, "session_name", "%s", s->name); format_add(ft, "session_windows", "%u", winlink_count(&s->windows)); - format_add(ft, "session_width", "%u", s->sx); - format_add(ft, "session_height", "%u", s->sy); format_add(ft, "session_id", "$%u", s->id); sg = session_group_contains(s); @@ -1508,18 +1522,14 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status)); format_add(ft, "pane_dead", "%d", wp->fd == -1); - if (window_pane_visible(wp)) { - format_add(ft, "pane_left", "%u", wp->xoff); - format_add(ft, "pane_top", "%u", wp->yoff); - format_add(ft, "pane_right", "%u", wp->xoff + wp->sx - 1); - format_add(ft, "pane_bottom", "%u", wp->yoff + wp->sy - 1); - format_add(ft, "pane_at_left", "%d", wp->xoff == 0); - format_add(ft, "pane_at_top", "%d", wp->yoff == 0); - format_add(ft, "pane_at_right", "%d", - wp->xoff + wp->sx == w->sx); - format_add(ft, "pane_at_bottom", "%d", - wp->yoff + wp->sy == w->sy); - } + format_add(ft, "pane_left", "%u", wp->xoff); + format_add(ft, "pane_top", "%u", wp->yoff); + format_add(ft, "pane_right", "%u", wp->xoff + wp->sx - 1); + format_add(ft, "pane_bottom", "%u", wp->yoff + wp->sy - 1); + format_add(ft, "pane_at_left", "%d", wp->xoff == 0); + format_add(ft, "pane_at_top", "%d", wp->yoff == 0); + format_add(ft, "pane_at_right", "%d", wp->xoff + wp->sx == w->sx); + format_add(ft, "pane_at_bottom", "%d", wp->yoff + wp->sy == w->sy); format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base); if (wp->mode != NULL) @@ -1534,6 +1544,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); |