#!/usr/bin/env python3 """Print the room's UI scale, clamped, as one number. There is one scale in a classroom and this is where everything asks for it: the Plasma session applies it to the display, and the browser and Wonder Ink are told it explicitly because Chrome was measured not to follow the compositor on its own. A shell script can read device.conf in one line, but then there are four places that clamp, default and parse a setting differently — which is how a room ends up with a panel at one size and a browser at another. """ import os import sys sys.path.insert(0, "/usr/local/lib/ekklesia-classroom") sys.path.insert( 0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "lib"), ) from classroom_config import read_device_config, ui_scale # noqa: E402 def main(): scale = ui_scale(read_device_config()) # 2 rather than 2.0: Chrome takes either, and a whole number is what a # person reads in a journal line without wondering what it means. if scale == int(scale): print(int(scale)) else: print(f"{scale:g}") return 0 if __name__ == "__main__": sys.exit(main())