Add a convenience option to kitty icat to print the screen size
This commit is contained in:
parent
8dea5b3e3e
commit
20611c7c15
@ -74,6 +74,13 @@ type=float
|
||||
default=10
|
||||
The amount of time (in seconds) to wait for a response form the terminal, when
|
||||
detecting image display support.
|
||||
|
||||
|
||||
--print-screen-size
|
||||
type=bool-set
|
||||
Print out the screen size as |_ widthxheight| (in pixels) and quit. This is a
|
||||
convenience method to query the screen size if using kitty icat from a
|
||||
scripting language that cannot make termios calls.
|
||||
'''
|
||||
|
||||
|
||||
@ -245,6 +252,10 @@ def main(args=sys.argv):
|
||||
' Directories are scanned recursively for image files.')
|
||||
args, items = parse_args(args[1:], options_spec, 'image-file ...', msg, '{} icat'.format(appname))
|
||||
|
||||
if args.print_screen_size:
|
||||
print('{}x{}'.format(screen_size().width, screen_size().height))
|
||||
raise SystemExit(0)
|
||||
|
||||
signal.signal(signal.SIGWINCH, lambda signum, frame: setattr(screen_size, 'changed', True))
|
||||
if not sys.stdout.isatty() or not sys.stdin.isatty():
|
||||
raise SystemExit(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user