Method: rich.console.Console.set_window_title
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
'hello' (1)
True (1)
1def set_window_title(self, title: str) -> bool:
2 """Set the title of the console terminal window.
3
4 Warning: There is no means within Rich of "resetting" the window title to its
5 previous value, meaning the title you set will persist even after your application
6 exits.
7
8 ``fish`` shell resets the window title before and after each command by default,
9 negating this issue. Windows Terminal and command prompt will also reset the title for you.
10 Most other shells and terminals, however, do not do this.
11
12 Some terminals may require configuration changes before you can set the title.
13 Some terminals may not support setting the title at all.
14
15 Other software (including the terminal itself, the shell, custom prompts, plugins, etc.)
16 may also set the terminal window title. This could result in whatever value you write
17 using this method being overwritten.
18
19 Args:
20 title (str): The new title of the terminal window.
21
22 Returns:
23 bool: True if the control code to change the terminal title was
24 written, otherwise False. Note that a return value of True
25 does not guarantee that the window title has actually changed,
26 since the feature may be unsupported/disabled in some terminals.
27 """
28 if self.is_terminal:
29 self.control(Control.title(title))
30 return True
31 return False