From 943bc34fbf8da6550036e1236085330f021d752a Mon Sep 17 00:00:00 2001 From: Tobin Date: Thu, 2 Apr 2015 01:46:46 -0500 Subject: [PATCH 1/2] added program title to terminal title --- rtv/__main__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtv/__main__.py b/rtv/__main__.py index bf8779c..cef78c1 100644 --- a/rtv/__main__.py +++ b/rtv/__main__.py @@ -15,6 +15,7 @@ from .curses_helpers import curses_session from .submission import SubmissionPage from .subreddit import SubredditPage from .docs import * +from .__version__ import __version__ __all__ = [] @@ -68,6 +69,13 @@ def main(): args = command_line() local_config = load_config() + # set the terminal title + title = 'rtv {0}'.format(__version__) + try: + sys.stdout.write("\x1b]2;{0}\x07".format(title)) + except: + os.system(title) + # Fill in empty arguments with config file values. Paramaters explicitly # typed on the command line will take priority over config file params. for key, val in local_config.items(): From 8f14be279713920eda7432d721b159cdad6b468e Mon Sep 17 00:00:00 2001 From: Tobin Date: Thu, 2 Apr 2015 12:43:02 -0500 Subject: [PATCH 2/2] fixed title for windows --- rtv/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtv/__main__.py b/rtv/__main__.py index cef78c1..44b5bd8 100644 --- a/rtv/__main__.py +++ b/rtv/__main__.py @@ -71,10 +71,10 @@ def main(): # set the terminal title title = 'rtv {0}'.format(__version__) - try: + if os.name == 'nt': + os.system('title {0}'.format(title)) + else: sys.stdout.write("\x1b]2;{0}\x07".format(title)) - except: - os.system(title) # Fill in empty arguments with config file values. Paramaters explicitly # typed on the command line will take priority over config file params.