mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d9f273c755 |
@@ -2568,8 +2568,8 @@ gui_window_set_title (const char *title)
|
||||
{
|
||||
char *new_title, *envterm, *envshell, *shell, *shellname;
|
||||
|
||||
envterm = getenv ("TERM");
|
||||
if (!envterm)
|
||||
/* check if term has status line support */
|
||||
if (!tgetflag ("hs"))
|
||||
return;
|
||||
|
||||
new_title = (title && title[0]) ?
|
||||
@@ -2577,57 +2577,8 @@ gui_window_set_title (const char *title)
|
||||
if (!new_title)
|
||||
return;
|
||||
|
||||
if (strcmp (envterm, "sun-cmd") == 0)
|
||||
{
|
||||
printf ("\033]l%s\033\\", new_title);
|
||||
}
|
||||
else if (strcmp (envterm, "hpterm") == 0)
|
||||
{
|
||||
printf ("\033&f0k%dD%s", (int)(strlen (new_title) + 1), new_title);
|
||||
}
|
||||
/* the following terminals support the xterm escape codes */
|
||||
else if ((strncmp (envterm, "xterm", 5) == 0)
|
||||
|| (strncmp (envterm, "rxvt", 4) == 0)
|
||||
|| (strncmp (envterm, "alacritty", 9) == 0)
|
||||
|| (strcmp (envterm, "Eterm") == 0)
|
||||
|| (strcmp (envterm, "aixterm") == 0)
|
||||
|| (strcmp (envterm, "iris-ansi") == 0)
|
||||
|| (strcmp (envterm, "dtterm") == 0))
|
||||
{
|
||||
printf ("\33]0;%s\7", new_title);
|
||||
}
|
||||
else if ((strncmp (envterm, "screen", 6) == 0)
|
||||
|| (strncmp (envterm, "tmux", 4) == 0))
|
||||
{
|
||||
if (title && title[0])
|
||||
{
|
||||
printf ("\033k%s\033\\", new_title);
|
||||
}
|
||||
else
|
||||
{
|
||||
envshell = getenv ("SHELL");
|
||||
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);
|
||||
}
|
||||
}
|
||||
/* trying to set the title of a backgrounded xterm like terminal */
|
||||
printf ("\33]0;%s\7", new_title);
|
||||
}
|
||||
printf ("%s%s%s", tgetstr ("ts"), new_title, tgetstr ("fs"));
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
free (new_title);
|
||||
|
||||
@@ -28,10 +28,13 @@
|
||||
#define NCURSES_WIDECHAR 1
|
||||
#ifdef HAVE_NCURSESW_CURSES_H
|
||||
#include <ncursesw/ncurses.h>
|
||||
#include <term.h>
|
||||
#elif HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#include <term.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#include <term.h>
|
||||
#endif /* HAVE_NCURSESW_CURSES_H */
|
||||
#endif /* WEECHAT_HEADLESS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user