From 7dda5c15d1f610132e8f8540b5d52b097a266fe5 Mon Sep 17 00:00:00 2001 From: Ali Hatami Tajik Date: Mon, 13 Mar 2023 17:11:36 +0330 Subject: [PATCH] Adds snippet list monitors --- src/scripts/python/setupmonitor.py | 10 ++++++++++ src/scripts/python/util/randr.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/scripts/python/setupmonitor.py b/src/scripts/python/setupmonitor.py index aa43d9e..3942701 100644 --- a/src/scripts/python/setupmonitor.py +++ b/src/scripts/python/setupmonitor.py @@ -28,6 +28,16 @@ Date: 2023 Mar 04 """ +import Xlib.display + +display = Xlib.display.Display() +root = display.screen().root +for m in root.xrandr_get_monitors(True).monitors: + connector = display.get_atom_name(m.name) + print( + f"{connector}, {m.width_in_pixels}x{m.height_in_pixels}, " + f"x={m.x}, y={m.y}" + ) if __name__ == "__main__": pass diff --git a/src/scripts/python/util/randr.py b/src/scripts/python/util/randr.py index 37fe1da..a278ce9 100644 --- a/src/scripts/python/util/randr.py +++ b/src/scripts/python/util/randr.py @@ -23,6 +23,8 @@ from enum import Enum from dataclasses import dataclass from typing import List +from Xlib.ext import randr as rnd + # TODO: Option class which can be applied by get_args method # TODO: Screen-related option class ~