mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-21 18:42:22 +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:
|
||||
enabled = False
|
||||
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 (
|
||||
name,
|
||||
primary,
|
||||
@ -49,6 +59,7 @@ def parse_monitor(line):
|
||||
int(pos_x),
|
||||
int(pos_y),
|
||||
enabled,
|
||||
orientation,
|
||||
)
|
||||
|
||||
|
||||
@ -164,6 +175,7 @@ class Window(QObject):
|
||||
pos_x,
|
||||
pos_y,
|
||||
enabled,
|
||||
orientation,
|
||||
) = parse_monitor(line)
|
||||
self.xrandr_info[name] = dict(
|
||||
primary=primary,
|
||||
@ -177,6 +189,7 @@ class Window(QObject):
|
||||
current_mode=None,
|
||||
enabled=enabled,
|
||||
replica_of=[],
|
||||
orientation=orientation,
|
||||
)
|
||||
elif line[0] == " ": # A mode
|
||||
mode_name = line.strip().split()[0]
|
||||
@ -212,6 +225,7 @@ class Window(QObject):
|
||||
self.ui.verticalScale.setValue(v_scale * 100)
|
||||
self.ui.primary.setChecked(self.xrandr_info[name]["primary"])
|
||||
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.addItem("None")
|
||||
|
22
main.ui
22
main.ui
@ -69,10 +69,30 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<widget class="QComboBox" name="orientationCombo">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</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>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
|
Loading…
Reference in New Issue
Block a user