Skip to content

Commit

Permalink
core: fix update of terminal title in some terminals like suckless te…
Browse files Browse the repository at this point in the history
…rminal (stterm) (closes #1882)
  • Loading branch information
flashcode committed Apr 23, 2023
1 parent 2d93f9d commit 9f5e8ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -32,6 +32,7 @@ New features::
* core, plugins: make many identifiers case sensitive (issue #1872, issue #398, bug #32213)
* core: add item "mouse_status" in default status bar, change default color to lightgreen
* core: add "stable-number" and "devel-number" in script version.sh
* core: fix update of terminal title in some terminals like suckless terminal (stterm) (issue #1882)
* api: add function config_set_version (issue #1238)
* api: add optional argument with version in info "version_number"
* alias: use lower case for default aliases, rename all aliases to lower case on upgrade (issue #1872)
Expand Down
16 changes: 5 additions & 11 deletions src/gui/curses/gui-curses-window.c
Expand Up @@ -2589,17 +2589,6 @@ gui_window_set_title (const char *title)
{
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))
{
Expand Down Expand Up @@ -2632,6 +2621,11 @@ gui_window_set_title (const char *title)
/* trying to set the title of a backgrounded xterm like terminal */
printf ("\33]0;%s\7", new_title);
}
else
{ /* we suppose all other terminals support the xterm escape codes */
printf ("\33]0;%s\7", new_title);
}

fflush (stdout);

free (new_title);
Expand Down

0 comments on commit 9f5e8ef

Please sign in to comment.