summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amade@asmblr.net>2016-10-19 17:54:11 +0200
committerAmadeusz Sławiński <amade@asmblr.net>2016-10-19 18:04:59 +0200
commit84f65b5a70d0c3de1b87590a8fb5610d183a45b3 (patch)
tree72ba922c538e964c370818bc75037a4903bb7506
parent324eb386efbf992636f52a3957190b16abee6f4f (diff)
downloadscreen-84f65b5a70d0c3de1b87590a8fb5610d183a45b3.tar.gz
add dynamicatitle and defdynamictitle commands
allows enabling/disabling window title change via escape sequences useful if you want to have one or more windows with static titles, but your shell or other screen aware application changes it Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
-rw-r--r--src/ansi.c3
-rw-r--r--src/comm.c2
-rw-r--r--src/process.c6
-rw-r--r--src/window.c4
-rw-r--r--src/window.h2
5 files changed, 16 insertions, 1 deletions
diff --git a/src/ansi.c b/src/ansi.c
index 152d2ef..ee61e2a 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1617,7 +1617,8 @@ StringEnd()
case AKA:
if (curr->w_title == curr->w_akabuf && !*curr->w_string)
break;
- ChangeAKA(curr, curr->w_string, strlen(curr->w_string));
+ if (curr->w_dynamicaka)
+ ChangeAKA(curr, curr->w_string, strlen(curr->w_string));
if (!*curr->w_string)
curr->w_autoaka = curr->w_y + 1;
break;
diff --git a/src/comm.c b/src/comm.c
index 09caf51..c11a5ae 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -145,6 +145,7 @@ struct comm comms[RC_LAST + 1] =
{ "defbreaktype", ARGS_01 },
{ "defc1", ARGS_1 },
{ "defcharset", ARGS_01 },
+ { "defdynamictitle", ARGS_1 },
#ifdef ENCODINGS
{ "defencoding", ARGS_1 },
#endif
@@ -184,6 +185,7 @@ struct comm comms[RC_LAST + 1] =
{ "dinfo", NEED_DISPLAY|ARGS_0 },
{ "displays", NEED_LAYER|ARGS_0 },
{ "dumptermcap", NEED_FORE|ARGS_0 },
+ { "dynamictitle", ARGS_1 },
{ "echo", CAN_QUERY|ARGS_12 },
#ifdef ENCODINGS
{ "encoding", ARGS_12 },
diff --git a/src/process.c b/src/process.c
index deaa3cc..63c85b1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2090,6 +2090,12 @@ int key;
}
}
break;
+ case RC_DEFDYNAMICTITLE:
+ (void)ParseOnOff(act, &nwin_default.dynamicaka);
+ break;
+ case RC_DYNAMICTITLE:
+ (void)ParseOnOff(act, &fore->w_dynamicaka);
+ break;
case RC_TITLE:
if (queryflag >= 0)
{
diff --git a/src/window.c b/src/window.c
index 2d16d57..3a64b26 100644
--- a/src/window.c
+++ b/src/window.c
@@ -126,6 +126,7 @@ struct NewWindow nwin_undef =
(char *)0, /* dir */
(char *)0, /* term */
-1, /* aflag */
+ -1, /* dynamicaka */
-1, /* flowflag */
-1, /* lflag */
-1, /* histheight */
@@ -152,6 +153,7 @@ struct NewWindow nwin_default =
0, /* dir */
screenterm, /* term */
0, /* aflag */
+ 1, /* dynamicaka */
1*FLOW_NOW, /* flowflag */
LOGINDEFAULT, /* lflag */
DEFAULTHISTHEIGHT, /* histheight */
@@ -185,6 +187,7 @@ struct NewWindow *def, *new, *res;
COMPOSE(dir);
COMPOSE(term);
COMPOSE(aflag);
+ COMPOSE(dynamicaka);
COMPOSE(flowflag);
COMPOSE(lflag);
COMPOSE(histheight);
@@ -684,6 +687,7 @@ struct NewWindow *newwin;
#endif
p->w_ptyfd = f;
p->w_aflag = nwin.aflag;
+ p->w_dynamicaka = nwin.dynamicaka;
p->w_flow = nwin.flowflag | ((nwin.flowflag & FLOW_AUTOFLAG) ? (FLOW_AUTO|FLOW_NOW) : FLOW_AUTO);
if (!nwin.aka)
nwin.aka = Filename(nwin.args[0]);
diff --git a/src/window.h b/src/window.h
index 3272b1c..fa82609 100644
--- a/src/window.h
+++ b/src/window.h
@@ -42,6 +42,7 @@ struct NewWindow
char *dir; /* directory for chdir */
char *term; /* TERM to be set instead of "screen" */
int aflag;
+ int dynamicaka;
int flowflag;
int lflag;
int histheight;
@@ -159,6 +160,7 @@ struct win
char w_outbuf[IOSIZE];
int w_outlen;
int w_aflag; /* (-a option) */
+ int w_dynamicaka; /* should we change name */
char *w_title; /* name of the window */
char *w_akachange; /* autoaka hack */
char w_akabuf[MAXSTR]; /* aka buffer */