История изменений
Исправление Darth_Revan, (текущая версия) :
Ну и Qt до кучи:
#!/usr/bin/env python3
import sys
import yaml
from PySide2 import QtCore, QtGui
def on_activate(app):
try:
out = {}
for screen in app.screens():
geom = screen.virtualGeometry()
out[screen.name()] = {
"name" : screen.name(),
"w" : geom.width(),
"h" : geom.height(),
"x" : geom.x(),
"y" : geom.y(),
"primary" : 1 if screen is app.primaryScreen() else 0,
}
yaml.dump(out, sys.stdout, default_flow_style=False)
finally:
app.quit()
app = QtGui.QGuiApplication(sys.argv)
QtCore.QTimer.singleShot(0, lambda: on_activate(app))
sys.exit(app.exec_())
Исправление Darth_Revan, :
Ну и Qt до кучи:
#!/usr/bin/env python3
import sys
import yaml
from PySide2 import QtCore, QtGui
def on_activate(app):
try:
out = {}
for screen in app.screens():
geom = screen.virtualGeometry()
out[screen.name()] = {
"name" : screen.name(),
"w" : geom.width(),
"h" : geom.height(),
"x" : geom.x(),
"y" : geom.y(),
"primary" : 1 if screen is app.primaryScreen() else 0,
}
yaml.dump(out, sys.stdout, default_flow_style=False)
finally:
app.quit()
app = QtGui.QGuiApplication(sys.argv)
QtCore.QTimer.singleShot(0, lambda: on_activate(app))
sys.exit(app.exec_())
Вариант на GDK работает слегка быстрее, но зато на Qt правильно отображается имя экрана под Weston.
Исходная версия Darth_Revan, :
Ну и Qt до кучи:
#!/usr/bin/env python3
import sys
import yaml
from PySide2 import QtCore, QtGui
def on_activate(app):
try:
out = {}
for screen in app.screens():
geom = screen.virtualGeometry()
out[screen.name()] = {
"name" : screen.name(),
"w" : geom.width(),
"h" : geom.height(),
"x" : geom.x(),
"y" : geom.y(),
"primary" : 1 if screen is app.primaryScreen() else 0,
}
yaml.dump(out, sys.stdout, default_flow_style=False)
finally:
app.quit()
app = QtGui.QGuiApplication(sys.argv)
QtCore.QTimer.singleShot(0, lambda: on_activate(app))
sys.exit(app.exec_())