Merge ~dirksu/plainbox-provider-checkbox:fixed_orientation into plainbox-provider-checkbox:master

Proposed by Dirk Su
Status: Needs review
Proposed branch: ~dirksu/plainbox-provider-checkbox:fixed_orientation
Merge into: plainbox-provider-checkbox:master
Diff against target: 58 lines (+31/-19)
1 file modified
bin/fixed_screen_orientation.sh (+31/-19)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Needs Information
Kai-Chuan Hsieh Approve
Maciej Kisielewski Pending
Checkbox Developers Pending
StanleyHuang Pending
Clair Lin Pending
PeiYao Chang Pending
Jonathan Cave Pending
Review via email: mp+430014@code.launchpad.net

Commit message

Use property PanelOrientationManaged to check autorotation

Description of the change

In Jammy, mutter add new property PanelOrientationManaged to expose panel auto orientation handling [1]. Proposed to use this property for more precise screen orientation detection. [2] for property description in
jammy source tree.

[1] https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
[2] https://git.launchpad.net/ubuntu/+source/mutter/tree/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml?h=ubuntu/jammy#n286

To post a comment you must log in.
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

LGTM.

review: Approve
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Please confirm the test still works with older releases (e.g focal) and using checkbox remote (as calls to dbus-send may not work as expected).

review: Needs Information

Unmerged commits

5e80d97... by Dirk Su

Use property PanelOrientationManaged to check autorotation

Mutter modified the panel autoration determine method and expose
in a PanelOrientationManaged readonly property

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/fixed_screen_orientation.sh b/bin/fixed_screen_orientation.sh
2index 5fbe162..77e7626 100755
3--- a/bin/fixed_screen_orientation.sh
4+++ b/bin/fixed_screen_orientation.sh
5@@ -1,22 +1,34 @@
6 #!/bin/sh
7-if ! (udevadm info --export-db | grep -q iio_device); then
8- echo "Screen orientation check PASSED:"
9- echo "no iio_device found in this device, therefore rotation should not happen."
10- exit 0
11-fi
12+orientation_managed=$(dbus-send --session --print-reply --dest=org.gnome.Mutter.DisplayConfig \
13+ /org/gnome/Mutter/DisplayConfig org.freedesktop.DBus.Properties.Get \
14+ string:org.gnome.Mutter.DisplayConfig string:PanelOrientationManaged 2>&1)
15
16-if dbus-send --system --print-reply --dest=net.hadess.SensorProxy \
17- /net/hadess/SensorProxy \
18- org.freedesktop.DBus.Properties.Get string:net.hadess.SensorProxy string:HasAccelerometer |
19- grep -q "boolean true"; then
20- echo "Screen orientation check FAILED:"
21- echo "this device has an accelerometer that needs to be disabled."
22- echo "==="
23- # list IIO devices for reference
24- echo "udevadm info /sys/bus/iio/devices/iio*"
25- udevadm info /sys/bus/iio/devices/iio*
26- exit 1
27-fi
28+if echo "$orientation_managed" | grep -q "No such property"; then
29+ if ! (udevadm info --export-db | grep -q iio_device); then
30+ echo "Screen orientation check PASSED:"
31+ echo "no iio_device found in this device, therefore rotation should not happen."
32+ exit 0
33+ fi
34
35-echo "Screen orientation check PASSED:"
36-echo "Accelerometer is not enabled."
37+ if dbus-send --system --print-reply --dest=net.hadess.SensorProxy \
38+ /net/hadess/SensorProxy \
39+ org.freedesktop.DBus.Properties.Get string:net.hadess.SensorProxy string:HasAccelerometer |
40+ grep -q "boolean true"; then
41+ echo "Screen orientation check FAILED:"
42+ echo "this device has an accelerometer that needs to be disabled."
43+ echo "==="
44+ # list IIO devices for reference
45+ echo "udevadm info /sys/bus/iio/devices/iio*"
46+ udevadm info /sys/bus/iio/devices/iio*
47+ exit 1
48+ fi
49+
50+ echo "Screen orientation check PASSED:"
51+ echo "Accelerometer is not enabled."
52+else
53+ if echo "$orientation_managed" | grep -q "boolean false"; then
54+ echo "Screen orientation check PASSED:"
55+ else
56+ echo "Screen orientation check FAILED:"
57+ fi
58+fi

Subscribers

People subscribed via source and target branches