diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-12 20:08:00 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-12 20:08:00 +0200 |
commit | 8a0c7c4d2d97c5b9f17cc69768d76e6afe734915 (patch) | |
tree | 6fcf104b7da45e8ec9f0c02c78905fdee9130299 | |
parent | user interface: hide cursor, set lflags, get window size + fetch window size updates (diff) | |
download | nightshift-8a0c7c4d2d97c5b9f17cc69768d76e6afe734915.tar.gz nightshift-8a0c7c4d2d97c5b9f17cc69768d76e6afe734915.tar.bz2 nightshift-8a0c7c4d2d97c5b9f17cc69768d76e6afe734915.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/interface.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/interface.py b/src/interface.py index 96c48b4..e657e0b 100644 --- a/src/interface.py +++ b/src/interface.py @@ -30,18 +30,18 @@ def user_interface(): ''' Start user interface ''' + (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) + sock.sendall('status\n'.encode('utf-8')) + def winch(signal, frame): + nonlocal height, width + (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) + signal.signal(signal.SIGWINCH, winch) print('\033[?1049h\033[?25l') saved_stty = termios.tcgetattr(sys.stdout.fileno()) stty = termios.tcgetattr(sys.stdout.fileno()) stty[3] &= ~(termios.ICANON | termios.ECHO | termios.ISIG) try: termios.tcsetattr(sys.stdout.fileno(), termios.TCSAFLUSH, stty) - (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) - sock.sendall('status\n'.encode('utf-8')) - def winch(signal, frame): - nonlocal height, width - (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) - signal.signal(signal.SIGWINCH, winch) def callback(status): if status is None: return |