Yes this is what tmux used to do, but you are forgetting konsole,
gnome-terminal, Eterm and many others.

I would check for the XT flag in terminfo in preference. Our terminfo is
new enough that it is present.

If setupterm() or similar has already been called by this point you can
try tigetflag("XT").

The other possibility is to default Config.set_window_title to off and
allow users to turn it on only when they are running on a terminal which
supports it.


On Tue, Jul 26, 2011 at 11:28:00AM +0200, David Coppa wrote:
> On Tue, 26 Jul 2011, Nicholas Marriott wrote:
> 
> > Well, this will stop it setting the title in xterm.
> > 
> > I guess it is right and the intent here is to STOP it setting the title
> > in the Linux console, even if the user turns it on.
> 
> Unfortunately I cannot test your patch until I'll be back home this evening.
> 
> Btw, I think that relying on the fact that "linux" is the only console not 
> understanding '\033' and '\007' is likewise wrong.
> 
> Maybe, this is a better diff:
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/ncmpcpp/Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 Makefile
> --- Makefile  25 Jul 2011 20:08:23 -0000      1.1.1.1
> +++ Makefile  26 Jul 2011 09:26:33 -0000
> @@ -3,6 +3,7 @@
>  COMMENT =            ncurses mpd client inspired by ncmpc
>  
>  DISTNAME =           ncmpcpp-0.5.7
> +REVISION =           0
>  
>  EXTRACT_SUFX =               .tar.bz2
>  
> Index: patches/patch-src_status_cpp
> ===================================================================
> RCS file: patches/patch-src_status_cpp
> diff -N patches/patch-src_status_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_status_cpp      26 Jul 2011 09:26:33 -0000
> @@ -0,0 +1,12 @@
> +$OpenBSD$
> +--- src/status.cpp.orig      Tue Jul 26 11:11:16 2011
> ++++ src/status.cpp   Tue Jul 26 11:11:21 2011
> +@@ -66,7 +66,7 @@ namespace
> + #ifndef USE_PDCURSES
> + void WindowTitle(const std::string &status)
> + {
> +-    if (strcmp(getenv("TERM"), "linux") && Config.set_window_title)
> ++    if (Config.set_window_title && (strstr("xterm", getenv("TERM")) != NULL 
> || strstr("rxvt", getenv("TERM")) != NULL))
> +             std::cout << "\033]0;" << status << "\7";
> + }
> + #endif // !USE_PDCURSES

Reply via email to