31 |
#include <signal.h> |
#include <signal.h> |
32 |
#include <time.h> |
#include <time.h> |
33 |
#include <ctype.h> |
#include <ctype.h> |
34 |
|
#include <libgen.h> |
35 |
|
|
36 |
#ifdef HAVE_NCURSESW_CURSES_H |
#ifdef HAVE_NCURSESW_CURSES_H |
37 |
#include <ncursesw/ncurses.h> |
#include <ncursesw/ncurses.h> |
3218 |
void |
void |
3219 |
gui_set_window_title () |
gui_set_window_title () |
3220 |
{ |
{ |
3221 |
#ifdef __linux__ |
if (strcmp (getenv ("TERM"), "screen") == 0) |
3222 |
/* set title for term window, not for console */ |
printf ("\033k%s %s\033\\", PACKAGE_NAME, PACKAGE_VERSION); |
3223 |
if (strcmp (getenv ("TERM"), "linux") != 0) |
else if (strcmp( getenv ("TERM"), "sun-cmd") == 0) |
3224 |
printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a"); |
printf ("\033]l%s %s\033\\", PACKAGE_NAME, PACKAGE_VERSION); |
3225 |
#endif |
else if (strcmp( getenv ("TERM"), "hpterm") == 0) |
3226 |
|
printf ("\033&f0k%dD%s %s", strlen(PACKAGE_NAME) + |
3227 |
|
strlen(PACKAGE_VERSION) + 1, |
3228 |
|
PACKAGE_NAME, PACKAGE_VERSION); |
3229 |
|
/* the following term supports the xterm excapes */ |
3230 |
|
else if (strncmp (getenv ("TERM"), "xterm", 5) == 0 |
3231 |
|
|| strncmp (getenv ("TERM"), "rxvt", 4) == 0 |
3232 |
|
|| strcmp( getenv ("TERM"), "aixterm") == 0 |
3233 |
|
|| strcmp( getenv ("TERM"), "iris-ansi") == 0 |
3234 |
|
|| strcmp( getenv ("TERM"), "dtterm") == 0) |
3235 |
|
printf ("\33]0;%s %s\7", PACKAGE_NAME, PACKAGE_VERSION); |
3236 |
|
} |
3237 |
|
|
3238 |
|
/* |
3239 |
|
* gui_reset_window_title: reset terminal title |
3240 |
|
*/ |
3241 |
|
|
3242 |
|
void |
3243 |
|
gui_reset_window_title () |
3244 |
|
{ |
3245 |
|
if (strcmp (getenv ("TERM"), "screen") == 0) |
3246 |
|
{ |
3247 |
|
char *shell, *shellname; |
3248 |
|
if (getenv ("SHELL")) |
3249 |
|
{ |
3250 |
|
shell = strdup (getenv ("SHELL")); |
3251 |
|
shellname = basename(shell); |
3252 |
|
if (shell) |
3253 |
|
{ |
3254 |
|
printf ("\033k%s\033\\", shellname); |
3255 |
|
free (shell); |
3256 |
|
} |
3257 |
|
else |
3258 |
|
printf ("\033k%s\033\\", getenv ("TERM")); |
3259 |
|
} |
3260 |
|
else |
3261 |
|
printf ("\033k%s\033\\", getenv ("TERM")); |
3262 |
|
} |
3263 |
|
else if (strcmp( getenv ("TERM"), "sun-cmd") == 0) |
3264 |
|
printf ("\033]l%s\033\\", "Terminal"); |
3265 |
|
else if (strcmp( getenv ("TERM"), "hpterm") == 0) |
3266 |
|
printf ("\033&f0k%dD%s", strlen("Terminal"), "Terminal"); |
3267 |
|
/* the following term supports the xterm excapes */ |
3268 |
|
else if (strncmp (getenv ("TERM"), "xterm", 5) == 0 |
3269 |
|
|| strncmp (getenv ("TERM"), "rxvt", 4) == 0 |
3270 |
|
|| strcmp( getenv ("TERM"), "aixterm") == 0 |
3271 |
|
|| strcmp( getenv ("TERM"), "iris-ansi") == 0 |
3272 |
|
|| strcmp( getenv ("TERM"), "dtterm") == 0) |
3273 |
|
printf ("\33]0;%s\7", "Terminal"); |
3274 |
} |
} |
3275 |
|
|
3276 |
/* |
/* |
3304 |
gui_buffer_new (gui_windows, NULL, NULL, 0, 1); |
gui_buffer_new (gui_windows, NULL, NULL, 0, 1); |
3305 |
|
|
3306 |
signal (SIGWINCH, gui_refresh_screen); |
signal (SIGWINCH, gui_refresh_screen); |
3307 |
|
|
3308 |
if (cfg_look_set_title) |
if (cfg_look_set_title) |
3309 |
gui_set_window_title (); |
gui_set_window_title (); |
3310 |
|
|
3357 |
/* delete infobar messages */ |
/* delete infobar messages */ |
3358 |
while (gui_infobar) |
while (gui_infobar) |
3359 |
gui_infobar_remove (); |
gui_infobar_remove (); |
3360 |
|
|
3361 |
|
/* reset title */ |
3362 |
|
if (cfg_look_set_title) |
3363 |
|
gui_reset_window_title (); |
3364 |
|
|
3365 |
/* end of curses output */ |
/* end of curses output */ |
3366 |
refresh (); |
refresh (); |