Created
October 24, 2021 14:14
-
-
Save saivert/4810fe0d925c261514c898e74d187fd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import dbus | |
bus = dbus.SessionBus() | |
request_iface = 'org.gnome.Mutter.DisplayConfig' | |
DisplayConfig = bus.get_object(request_iface, | |
'/org/gnome/Mutter/DisplayConfig') | |
data = DisplayConfig.GetCurrentState(dbus_interface=request_iface) | |
print("List of monitors:") | |
for d in data[1]: | |
print ("Display: %s"%(d[2].get("display-name"))) | |
print (" List of modes (* = current mode):") | |
for mode in d[1]: | |
print (" %dx%d %dHz "%(mode[1], mode[2], mode[3]), end='') | |
if mode[6].get("is-current"): | |
print (" *") | |
else: | |
print ("") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment