mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 12:27:59 +01:00
full block cursor under linux vt
This commit is contained in:
parent
d5328a32f7
commit
29855b2263
1 changed files with 3 additions and 0 deletions
|
@ -77,8 +77,10 @@ class PonysayTool():
|
|||
if not os.path.isfile(pony):
|
||||
printerr('%s is not an existing regular file' % pony)
|
||||
exit(252)
|
||||
linuxvt = ('TERM' in os.environ) and (os.environ['TERM'] == 'linux')
|
||||
try:
|
||||
print('\033[?1049h', end='') # initialise terminal
|
||||
if linuxvt: print('\033[?8c', end='') # use full block for cursor (_ is used by default in linux vt)
|
||||
cmd = 'stty %s < %s > /dev/null 2> /dev/null'
|
||||
cmd %= ('-echo -icanon -isig', os.path.realpath('/dev/stdout'))
|
||||
Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).wait()
|
||||
|
@ -87,6 +89,7 @@ class PonysayTool():
|
|||
cmd = 'stty %s < %s > /dev/null 2> /dev/null'
|
||||
cmd %= ('echo icanon isig', os.path.realpath('/dev/stdout'))
|
||||
Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).wait()
|
||||
if linuxvt: print('\033[?0c', end='') # restore cursor
|
||||
print('\033[?1049l', end='') # terminate terminal
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue