import gi gi.require_version("Gtk", "3.0") gi.require_version("WebKit2", "4.1") from gi.repository import Gtk, Gdk def get_monitor_info(monitor): return { "model": monitor.props.model, "scale_factor": monitor.props.scale_factor, "manufacturer": monitor.props.manufacturer, "refresh_rate": monitor.props.refresh_rate, "is_primary": monitor.is_primary(), "geometry": { "width": monitor.props.geometry.width, "height": monitor.props.geometry.height, "x": monitor.props.geometry.x, "y": monitor.props.geometry.y, } } display = Gdk.Display.get_default() monitor_num = display.get_n_monitors() monitors = [display.get_monitor(i) for i in range(monitor_num)] monitors = [get_monitor_info(m) for m in monitors]