Skip to content

Instantly share code, notes, and snippets.

@harshithjv
Created February 22, 2016 12:07
Show Gist options
  • Select an option

  • Save harshithjv/b00b20c06248812100e8 to your computer and use it in GitHub Desktop.

Select an option

Save harshithjv/b00b20c06248812100e8 to your computer and use it in GitHub Desktop.
Renames shell title with current folder name.
import sys
import os
if sys.platform == 'linux2':
os.system('echo -en "\033]0;$(basename $(pwd))\007"')
elif sys.platform == 'win32': #does not work as it will sets title inside a new prompt for the current execution and disappears after executing
(directory, base_name) = os.path.split(os.getcwd())
if not base_name:
base_name = directory
os.system('title %s' % base_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment