mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-25 05:47:59 +01:00
Restore custom linuxvt palette
This commit is contained in:
parent
b648be7cf5
commit
dce3824589
1 changed files with 20 additions and 1 deletions
|
@ -904,8 +904,25 @@ class Ponysay():
|
||||||
pony = KMS.kms(pony, self.HOME, self.linuxvt)
|
pony = KMS.kms(pony, self.HOME, self.linuxvt)
|
||||||
|
|
||||||
## If in Linux VT clean the terminal (See info/pdf-manual [Printing in TTY with KMS])
|
## If in Linux VT clean the terminal (See info/pdf-manual [Printing in TTY with KMS])
|
||||||
|
palette = ''
|
||||||
if self.linuxvt:
|
if self.linuxvt:
|
||||||
print('\033[H\033[2J', end='')
|
print('\033[H\033[2J', end='')
|
||||||
|
pal = []
|
||||||
|
red = []
|
||||||
|
with open('/sys/module/vt/parameters/default_red') as f:
|
||||||
|
red = f.readline().split(',')
|
||||||
|
f.close()
|
||||||
|
grn = []
|
||||||
|
with open('/sys/module/vt/parameters/default_grn') as f:
|
||||||
|
grn = f.readline().split(',')
|
||||||
|
f.close()
|
||||||
|
blu = []
|
||||||
|
with open('/sys/module/vt/parameters/default_blu') as f:
|
||||||
|
blu = f.readline().split(',')
|
||||||
|
f.close()
|
||||||
|
for i in range(16):
|
||||||
|
pal.append('\033]P{idx:X}{red:0>2X}{grn:0>2X}{blu:0>2X}'.format(idx = i, red = int(red[i]), grn = int(grn[i]), blu = int(blu[i])))
|
||||||
|
palette = ''.join(pal)
|
||||||
|
|
||||||
## Get width truncation and wrapping
|
## Get width truncation and wrapping
|
||||||
widthtruncation = self.__getWidthTruncation()
|
widthtruncation = self.__getWidthTruncation()
|
||||||
|
@ -938,7 +955,9 @@ class Ponysay():
|
||||||
|
|
||||||
## Print the output, truncated on the height
|
## Print the output, truncated on the height
|
||||||
self.__printOutput(output)
|
self.__printOutput(output)
|
||||||
|
|
||||||
|
if self.linuxvt:
|
||||||
|
print(palette)
|
||||||
|
|
||||||
def __getSelectedPonies(self, args, selection):
|
def __getSelectedPonies(self, args, selection):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue