Since 0.24 eix-update displays what it is doing on the status bar when run under tmux. It doesn't however clear its status on exit. The result is the following: 0:su- 1:eix-update: Finished* 2:log 3:ncmpcpp ... As you can see screen number 1 still shows the status after eix-update finished instead of "su". Reproducible: Always
The same with byobu and screen as backend.
This is what weechat does, maybe it can be adopted: void gui_window_set_title (const char *title) { char *shell, *shellname; char *envterm = getenv ("TERM"); char *envshell = getenv ("SHELL"); if (envterm) { if (title && title[0]) { if (strcmp (envterm, "sun-cmd") == 0) { printf ("\033]l%s\033\\", title); } else if (strcmp (envterm, "hpterm") == 0) { printf ("\033&f0k%dD%s", (int)(strlen(title) + 1), title); } /* the following term supports the xterm excapes */ else if ((strncmp (envterm, "xterm", 5) == 0) || (strncmp (envterm, "rxvt", 4) == 0) || (strcmp (envterm, "Eterm") == 0) || (strcmp (envterm, "aixterm") == 0) || (strcmp (envterm, "iris-ansi") == 0) || (strcmp (envterm, "dtterm") == 0)) { printf ("\33]0;%s\7", title); } else if (strncmp (envterm, "screen", 6) == 0) { printf ("\033k%s\033\\", title); /* trying to set the title of a backgrounded xterm like terminal */ printf ("\33]0;%s\7", title); } } else { if (strcmp (envterm, "sun-cmd") == 0) { printf ("\033]l%s\033\\", "Terminal"); } else if (strcmp (envterm, "hpterm") == 0) { printf ("\033&f0k%dD%s", (int)strlen("Terminal"), "Terminal"); } /* the following term supports the xterm excapes */ else if ((strncmp (envterm, "xterm", 5) == 0) || (strncmp (envterm, "rxvt", 4) == 0) || (strcmp (envterm, "Eterm") == 0) || (strcmp( envterm, "aixterm") == 0) || (strcmp( envterm, "iris-ansi") == 0) || (strcmp( envterm, "dtterm") == 0)) { printf ("\33]0;%s\7", "Terminal"); } else if (strncmp (envterm, "screen", 6) == 0) { if (envshell) { shell = strdup (envshell); if (shell) { shellname = basename (shell); printf ("\033k%s\033\\", (shellname) ? shellname : shell); free (shell); } else { printf ("\033k%s\033\\", envterm); } } else { printf ("\033k%s\033\\", envterm); } /* tryning to reset the title of a backgrounded xterm like terminal */ printf ("\33]0;%s\7", "Terminal"); } } fflush (stdout); } }
eix-update tries to set the "name" of the window, overriding the name tmux automatically set with "automatic-rename", which is truly annoying for me, too. Anyway, I used this in .tmux.conf to solve the issue: setw -g allow-rename off It would prevent other applications from setting the window name, too. Anyway, they still have "title" to mess up.
It is not possible to get the previous status line: No program which sets the status line can "clear" it. (Well, it can set an empty title, but this would give you an empty string instead of "su -" in your example.) For instance, also emerge only sets some "random" status line on exit. The current exit text (describing the status) appears to be the most reasonable. If you have a good prompt, it should set the title by itself when the prompt appears again. ;) If you do not want that an eix tool changes the statusline, set NOSTATUSLINE=true (in /etc/eixrc or in your environment) or adopt the TERM_{SOFT,}STATUSLINE values to your needs (see eix --dump).
(In reply to comment #4) > It is not possible to get the previous status line: > No program which sets the status line can "clear" it. > (Well, it can set an empty title, but this would give you an empty > string instead of "su -" in your example.) > > For instance, also emerge only sets some "random" status line on exit. > The current exit text (describing the status) appears to be > the most reasonable. No. As you can see in the code snipped above, sane programs set the status line to the name of the shell when they exit. This is better than leaving the long exit text forever...
(In reply to comment #5) > No. As you can see in the code snipped above, sane programs > set the status line to the name of the shell when they exit. The fixed string "Terminal" or the $SHELL environment variable (which is not even set in every shell, even less exported; not to speak that especially in screen/tmux the program need not have been called from a shell) is as sane as any other random choice of text like "${USER}@${HOST}:${PWD}" (as in portage) or a success/failure text (as in eix). The latter at least contains some real information. I think it would be overdone to make this final string configurable, but OTOH eix has configure variables for almost everything, anyway.
Just for the records, since it came up on a mailinglist: Since eix-0,25.1 there is an EXIT_STATUSLINE variable. You can set it e.g. in /etc/eixrc to any (fixed) exit statusline you want if you do not agree with the default (An optional leading space is ignored so that e.g. EXIT_STATUSLINE=" " will give you an empty exit statusline). I guess that this configuration option is about the best which can be done about the problem.
*** Bug 465074 has been marked as a duplicate of this bug. ***