/usr/lib/plainbox-provider-checkbox/bin/resolution_test is in plainbox-provider-checkbox 0.25-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #!/usr/bin/env python3
import sys
from argparse import ArgumentParser
from gi.repository import Gdk
def check_resolution():
screen = Gdk.Screen.get_default()
n = screen.get_n_monitors()
for i in range(n):
geom = screen.get_monitor_geometry(i)
print('Monitor %d:' % (i + 1))
print(' %d x %d' % (geom.width, geom.height))
def compare_resolution(min_h, min_v):
# Evaluate just the primary display
screen = Gdk.Screen.get_default()
geom = screen.get_monitor_geometry(screen.get_primary_monitor())
print("Minimum acceptable display resolution: %d x %d" % (min_h, min_v))
print("Detected display resolution: %d x %d" % (geom.width, geom.height))
return geom.width >= min_h and geom.height >= min_v
def main():
parser = ArgumentParser()
parser.add_argument("--horizontal",
type=int,
default=0,
help="Minimum acceptable horizontal resolution.")
parser.add_argument("--vertical",
type=int,
default=0,
help="Minimum acceptable vertical resolution.")
args = parser.parse_args()
if (args.horizontal > 0) and (args.vertical > 0):
return not compare_resolution(args.horizontal, args.vertical)
else:
check_resolution()
return 0
if __name__ == "__main__":
sys.exit(main())
|