Set terminal title to reflect current page
This commit is contained in:
@@ -11,6 +11,7 @@ from kitchen.text.display import textual_width
|
|||||||
from . import docs
|
from . import docs
|
||||||
from .objects import Controller, Color, Command
|
from .objects import Controller, Color, Command
|
||||||
from .exceptions import TemporaryFileError
|
from .exceptions import TemporaryFileError
|
||||||
|
from .__version__ import __version__
|
||||||
|
|
||||||
|
|
||||||
def logged_in(f):
|
def logged_in(f):
|
||||||
@@ -282,6 +283,11 @@ class Page(object):
|
|||||||
sub_name = self.content.name.replace('/r/front', 'Front Page')
|
sub_name = self.content.name.replace('/r/front', 'Front Page')
|
||||||
self.term.add_line(window, sub_name, 0, 0)
|
self.term.add_line(window, sub_name, 0, 0)
|
||||||
|
|
||||||
|
# Set the terminal title
|
||||||
|
title = sub_name + ' - rtv {0}'.format(__version__)
|
||||||
|
sys.stdout.write('\x1b]2;{0}\x07'.format(title))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
if self.reddit.user is not None:
|
if self.reddit.user is not None:
|
||||||
# The starting position of the name depends on if we're converting
|
# The starting position of the name depends on if we're converting
|
||||||
# to ascii or not
|
# to ascii or not
|
||||||
@@ -415,4 +421,4 @@ class Page(object):
|
|||||||
|
|
||||||
n_rows, _ = window.getmaxyx()
|
n_rows, _ = window.getmaxyx()
|
||||||
for row in range(n_rows):
|
for row in range(n_rows):
|
||||||
window.chgat(row, 0, 1, attribute)
|
window.chgat(row, 0, 1, attribute)
|
||||||
|
|||||||
Reference in New Issue
Block a user