mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
Add window_activity format, from Thomas Adam based on a diff originally
from propos6 at gmail dot com.
This commit is contained in:
parent
29c29e7717
commit
d96ab34019
5
format.c
5
format.c
@ -749,6 +749,7 @@ void
|
|||||||
format_defaults_window(struct format_tree *ft, struct window *w)
|
format_defaults_window(struct format_tree *ft, struct window *w)
|
||||||
{
|
{
|
||||||
char *layout;
|
char *layout;
|
||||||
|
time_t t;
|
||||||
|
|
||||||
ft->w = w;
|
ft->w = w;
|
||||||
|
|
||||||
@ -757,6 +758,10 @@ format_defaults_window(struct format_tree *ft, struct window *w)
|
|||||||
else
|
else
|
||||||
layout = layout_dump(w->layout_root);
|
layout = layout_dump(w->layout_root);
|
||||||
|
|
||||||
|
t = w->activity_time.tv_sec;
|
||||||
|
format_add(ft, "window_activity", "%lld", (long long) t);
|
||||||
|
format_add(ft, "window_activity_string", "%s", format_time_string(t));
|
||||||
|
|
||||||
format_add(ft, "window_id", "@%u", w->id);
|
format_add(ft, "window_id", "@%u", w->id);
|
||||||
format_add(ft, "window_name", "%s", w->name);
|
format_add(ft, "window_name", "%s", w->name);
|
||||||
format_add(ft, "window_width", "%u", w->sx);
|
format_add(ft, "window_width", "%u", w->sx);
|
||||||
|
4
input.c
4
input.c
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
@ -849,6 +850,9 @@ input_parse(struct window_pane *wp)
|
|||||||
wp->window->flags |= WINDOW_ACTIVITY;
|
wp->window->flags |= WINDOW_ACTIVITY;
|
||||||
wp->window->flags &= ~WINDOW_SILENCE;
|
wp->window->flags &= ~WINDOW_SILENCE;
|
||||||
|
|
||||||
|
if (gettimeofday(&wp->window->activity_time, NULL) != 0)
|
||||||
|
fatal("gettimeofday failed");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the screen. Use NULL wp if there is a mode set as don't want to
|
* Open the screen. Use NULL wp if there is a mode set as don't want to
|
||||||
* update the tty.
|
* update the tty.
|
||||||
|
2
tmux.1
2
tmux.1
@ -3414,6 +3414,8 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "session_name" Ta "#S" Ta "Name of session"
|
.It Li "session_name" Ta "#S" Ta "Name of session"
|
||||||
.It Li "session_width" Ta "" Ta "Width of session"
|
.It Li "session_width" Ta "" Ta "Width of session"
|
||||||
.It Li "session_windows" Ta "" Ta "Number of windows in session"
|
.It Li "session_windows" Ta "" Ta "Number of windows in session"
|
||||||
|
.It Li "window_activity" Ta "" Ta "Integer time of window last activity"
|
||||||
|
.It Li "window_activity_string" Ta "" Ta "String time of window last activity"
|
||||||
.It Li "window_active" Ta "" Ta "1 if window active"
|
.It Li "window_active" Ta "" Ta "1 if window active"
|
||||||
.It Li "window_activity_flag" Ta "" Ta "1 if window has activity alert"
|
.It Li "window_activity_flag" Ta "" Ta "1 if window has activity alert"
|
||||||
.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
|
.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
|
||||||
|
1
tmux.h
1
tmux.h
@ -892,6 +892,7 @@ struct window {
|
|||||||
char *name;
|
char *name;
|
||||||
struct event name_timer;
|
struct event name_timer;
|
||||||
struct timeval silence_timer;
|
struct timeval silence_timer;
|
||||||
|
struct timeval activity_time;
|
||||||
|
|
||||||
struct window_pane *active;
|
struct window_pane *active;
|
||||||
struct window_pane *last;
|
struct window_pane *last;
|
||||||
|
3
window.c
3
window.c
@ -295,6 +295,9 @@ window_create1(u_int sx, u_int sy)
|
|||||||
w->sx = sx;
|
w->sx = sx;
|
||||||
w->sy = sy;
|
w->sy = sy;
|
||||||
|
|
||||||
|
if (gettimeofday(&w->activity_time, NULL) != 0)
|
||||||
|
fatal("gettimeofday failed");
|
||||||
|
|
||||||
options_init(&w->options, &global_w_options);
|
options_init(&w->options, &global_w_options);
|
||||||
if (options_get_number(&w->options, "automatic-rename"))
|
if (options_get_number(&w->options, "automatic-rename"))
|
||||||
queue_window_name(w);
|
queue_window_name(w);
|
||||||
|
Loading…
Reference in New Issue
Block a user