mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
scripts/generate-alt-random-writes: use TIOCGWINSZ instead of shutil
This commit is contained in:
parent
8cf3cec920
commit
3bc6db1e8c
1 changed files with 8 additions and 4 deletions
|
|
@ -1,8 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import enum
|
||||
import shutil
|
||||
import fcntl
|
||||
import struct
|
||||
import sys
|
||||
import termios
|
||||
|
||||
|
||||
class ColorVariant(enum.IntEnum):
|
||||
|
|
@ -25,9 +27,11 @@ def main():
|
|||
opts = parser.parse_args()
|
||||
out = opts.out if opts.out is not None else sys.stdout
|
||||
|
||||
term_size = shutil.get_terminal_size()
|
||||
lines = term_size.lines
|
||||
cols = term_size.columns
|
||||
lines, cols, _, _ = struct.unpack(
|
||||
'HHHH',
|
||||
fcntl.ioctl(sys.stdout.fileno(),
|
||||
termios.TIOCGWINSZ,
|
||||
struct.pack('HHHH', 0, 0, 0, 0)))
|
||||
|
||||
# Number of characters to write to screen
|
||||
count = 256 * 1024**1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue