mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-31 07:11:09 -04: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
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import enum
|
import enum
|
||||||
import shutil
|
import fcntl
|
||||||
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
import termios
|
||||||
|
|
||||||
|
|
||||||
class ColorVariant(enum.IntEnum):
|
class ColorVariant(enum.IntEnum):
|
||||||
|
|
@ -25,9 +27,11 @@ def main():
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
out = opts.out if opts.out is not None else sys.stdout
|
out = opts.out if opts.out is not None else sys.stdout
|
||||||
|
|
||||||
term_size = shutil.get_terminal_size()
|
lines, cols, _, _ = struct.unpack(
|
||||||
lines = term_size.lines
|
'HHHH',
|
||||||
cols = term_size.columns
|
fcntl.ioctl(sys.stdout.fileno(),
|
||||||
|
termios.TIOCGWINSZ,
|
||||||
|
struct.pack('HHHH', 0, 0, 0, 0)))
|
||||||
|
|
||||||
# Number of characters to write to screen
|
# Number of characters to write to screen
|
||||||
count = 256 * 1024**1
|
count = 256 * 1024**1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue