import subprocess def get_num_screens(): from Xlib import display as xdisplay num_monitors = 0 try: display = xdisplay.Display() screen = display.screen() resources = screen.root.xrandr_get_screen_resources() for output in resources.outputs: monitor = display.xrandr_get_output_info(output, resources.config_timestamp) preferred = False if hasattr(monitor, "preferred"): preferred = monitor.preferred elif hasattr(monitor, "num_preferred"): preferred = monitor.num_preferred if preferred: num_monitors += 1 except: raise return 1 else: return num_monitors def get_network_interface(): proc_ip = subprocess.Popen(['ip', 'route', 'get', '8.8.8.8'], stdout=subprocess.PIPE) proc_awk = subprocess.check_output(['awk', '--', "{printf $5}"], stdin=proc_ip.stdout) proc_ip.stdout.close() return proc_awk.decode('utf-8') class Colors: bg = ["#282828", "#3c3836"] #background bg1 = ["#3c3836", "#504945"] bg2 = ["#504945", "#665c54"] bg3 = ["#665c54", "#7c6f64"] fg = ["#ebdbb2", "#fbf1c7"] #foreground fg1 = ["#d5c4a1", "#ebdbb2"] fg2 = ["#bdae93", "#d5c4a1"] fg3 = ["#a89984", "#bdae93"] red = ["#cc241d", "#fb4934"] green = ["#98971a", "#b8bb26"] yellow = ["#d79921", "#fabd2f"] blue = ["#458588", "#83a598"] purple = ["#b16286", "#d3869b"] aqua = ["#689d6a", "#8ec07c"] orange = ["#d65d0e", "#fe8019"] gray = ["#928374", "#a89984"] grey = gray def _init_(self ): pass if __name__ == "__main__": print("Number of Screens: {}".format(get_num_screens()))