Show More
@@ -0,0 +1,2 b'' | |||
|
1 | An additional flag `--term-title-format` is introduced to allow the user to control the format of the terminal | |
|
2 | title. It is specified as a python format string, and currently the only variable it will format is `{cwd}`. |
@@ -352,7 +352,7 b' class OSMagics(Magics):' | |||
|
352 | 352 | try: |
|
353 | 353 | os.chdir(os.path.expanduser(ps)) |
|
354 | 354 | if hasattr(self.shell, 'term_title') and self.shell.term_title: |
|
355 |
set_term_title( |
|
|
355 | set_term_title(self.shell.term_title_format.format(cwd=abbrev_cwd())) | |
|
356 | 356 | except OSError: |
|
357 | 357 | print(sys.exc_info()[1]) |
|
358 | 358 | else: |
@@ -365,7 +365,7 b' class OSMagics(Magics):' | |||
|
365 | 365 | else: |
|
366 | 366 | os.chdir(self.shell.home_dir) |
|
367 | 367 | if hasattr(self.shell, 'term_title') and self.shell.term_title: |
|
368 | set_term_title('IPython: ' + '~') | |
|
368 | set_term_title(self.shell.term_title_format.format(cwd="~")) | |
|
369 | 369 | cwd = os.getcwd() |
|
370 | 370 | dhist = self.shell.user_ns['_dh'] |
|
371 | 371 |
@@ -179,6 +179,11 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
179 | 179 | help="Automatically set the terminal title" |
|
180 | 180 | ).tag(config=True) |
|
181 | 181 | |
|
182 | term_title_format = Unicode("IPython: {cwd}", | |
|
183 | help="Customize the terminal title format. This is a python format string. " + | |
|
184 | "Available substitutions are: {cwd}." | |
|
185 | ).tag(config=True) | |
|
186 | ||
|
182 | 187 | display_completions = Enum(('column', 'multicolumn','readlinelike'), |
|
183 | 188 | help= ( "Options for displaying tab completions, 'column', 'multicolumn', and " |
|
184 | 189 | "'readlinelike'. These options are for `prompt_toolkit`, see " |
@@ -206,7 +211,7 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
206 | 211 | # Enable or disable the terminal title. |
|
207 | 212 | if self.term_title: |
|
208 | 213 | toggle_set_term_title(True) |
|
209 |
set_term_title( |
|
|
214 | set_term_title(self.term_title_format.format(cwd=abbrev_cwd())) | |
|
210 | 215 | else: |
|
211 | 216 | toggle_set_term_title(False) |
|
212 | 217 |
General Comments 0
You need to be logged in to leave comments.
Login now