mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-25 04:12:23 +00:00
Parse monitor orientation
This commit is contained in:
parent
dbc16fc533
commit
93ddde5f47
14
main.py
14
main.py
@ -39,6 +39,16 @@ def parse_monitor(line):
|
|||||||
else:
|
else:
|
||||||
enabled = False
|
enabled = False
|
||||||
res_x = res_y = pos_x = pos_y = w_in_mm = h_in_mm = 0
|
res_x = res_y = pos_x = pos_y = w_in_mm = h_in_mm = 0
|
||||||
|
|
||||||
|
left_side = line.split(' (normal left inverted ')[0]
|
||||||
|
orientation = 0
|
||||||
|
if 'left' in left_side:
|
||||||
|
orientation = 1
|
||||||
|
elif 'inverted' in left_side:
|
||||||
|
orientation = 2
|
||||||
|
elif 'right' in left_side:
|
||||||
|
orientation = 3
|
||||||
|
|
||||||
return (
|
return (
|
||||||
name,
|
name,
|
||||||
primary,
|
primary,
|
||||||
@ -49,6 +59,7 @@ def parse_monitor(line):
|
|||||||
int(pos_x),
|
int(pos_x),
|
||||||
int(pos_y),
|
int(pos_y),
|
||||||
enabled,
|
enabled,
|
||||||
|
orientation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -164,6 +175,7 @@ class Window(QObject):
|
|||||||
pos_x,
|
pos_x,
|
||||||
pos_y,
|
pos_y,
|
||||||
enabled,
|
enabled,
|
||||||
|
orientation,
|
||||||
) = parse_monitor(line)
|
) = parse_monitor(line)
|
||||||
self.xrandr_info[name] = dict(
|
self.xrandr_info[name] = dict(
|
||||||
primary=primary,
|
primary=primary,
|
||||||
@ -177,6 +189,7 @@ class Window(QObject):
|
|||||||
current_mode=None,
|
current_mode=None,
|
||||||
enabled=enabled,
|
enabled=enabled,
|
||||||
replica_of=[],
|
replica_of=[],
|
||||||
|
orientation=orientation,
|
||||||
)
|
)
|
||||||
elif line[0] == " ": # A mode
|
elif line[0] == " ": # A mode
|
||||||
mode_name = line.strip().split()[0]
|
mode_name = line.strip().split()[0]
|
||||||
@ -212,6 +225,7 @@ class Window(QObject):
|
|||||||
self.ui.verticalScale.setValue(v_scale * 100)
|
self.ui.verticalScale.setValue(v_scale * 100)
|
||||||
self.ui.primary.setChecked(self.xrandr_info[name]["primary"])
|
self.ui.primary.setChecked(self.xrandr_info[name]["primary"])
|
||||||
self.ui.enabled.setChecked(self.xrandr_info[name]["enabled"])
|
self.ui.enabled.setChecked(self.xrandr_info[name]["enabled"])
|
||||||
|
self.ui.orientationCombo.setCurrentIndex(self.xrandr_info[name]["orientation"])
|
||||||
|
|
||||||
self.ui.replicaOf.clear()
|
self.ui.replicaOf.clear()
|
||||||
self.ui.replicaOf.addItem("None")
|
self.ui.replicaOf.addItem("None")
|
||||||
|
22
main.ui
22
main.ui
@ -69,10 +69,30 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QComboBox" name="comboBox_3">
|
<widget class="QComboBox" name="orientationCombo">
|
||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QComboBox::AdjustToContents</enum>
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Normal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Left (90° cw)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Inverted (180°)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Right (90° ccw)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
|
Loading…
Reference in New Issue
Block a user