diff options
-rwxr-xr-x | unstickpixels | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/unstickpixels b/unstickpixels index 2068ea8..d3aba07 100755 --- a/unstickpixels +++ b/unstickpixels @@ -19,6 +19,7 @@ ## import sys +import time from subprocess import Popen, PIPE @@ -27,6 +28,9 @@ def print(text, end = '\n'): sys.stdout.buffer.flush() +sleep = 0 if len(sys.argv) < 2 else int(sys.argv[1]) + + (height, width) = Popen(['stty', 'size'], stdout=PIPE).communicate()[0].decode('utf-8', 'replace').split(' ') (height, width) = (int(height), int(width)) COPYING = ['unstickpixels – screen loop to try to unstick dead pixels', @@ -55,13 +59,26 @@ try: input() started = True print('\033[H', '') - while True: - sys.stdout.buffer.write('\033]P0FF0000\033[2J'.encode('utf-8')) - sys.stdout.buffer.flush() - sys.stdout.buffer.write('\033]P000FF00\033[2J'.encode('utf-8')) - sys.stdout.buffer.flush() - sys.stdout.buffer.write('\033]P00000FF\033[2J'.encode('utf-8')) - sys.stdout.buffer.flush() + if sleep == 0: + while True: + sys.stdout.buffer.write('\033]P0FF0000\033[2J'.encode('utf-8')) + sys.stdout.buffer.flush() + sys.stdout.buffer.write('\033]P000FF00\033[2J'.encode('utf-8')) + sys.stdout.buffer.flush() + sys.stdout.buffer.write('\033]P00000FF\033[2J'.encode('utf-8')) + sys.stdout.buffer.flush() + else: + sleep /= 1000 + while True: + sys.stdout.buffer.write('\033]P0FF0000\033[2J'.encode('utf-8')) + sys.stdout.buffer.flush() + time.sleep(sleep) + sys.stdout.buffer.write('\033]P000FF00\033[2J'.encode('utf-8')) + sys.stdout.buffer.flush() + time.sleep(sleep) + sys.stdout.buffer.write('\033]P00000FF\033[2J'.encode('utf-8')) + sys.stdout.buffer.flush() + time.sleep(sleep) except: pass if started: |