summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/rotation_test.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/rotation_test.py b/bin/rotation_test.py
index f3467b8..d6a5b47 100755
--- a/bin/rotation_test.py
+++ b/bin/rotation_test.py
@@ -23,8 +23,11 @@
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
import gi
+import os
import time
import subprocess
+import warnings
+warnings.filterwarnings("ignore", category=DeprecationWarning)
gi.require_version('Gdk', '3.0')
from gi.repository import Gdk # noqa: E402
@@ -35,11 +38,14 @@ def main():
screen = Gdk.Screen.get_default()
output = screen.get_monitor_plug_name(screen.get_primary_monitor())
print("Using output: {}".format(output))
-
for rotation in ['right', 'inverted', 'left', 'normal']:
- print("Changing rotation to: {}".format(rotation))
- subprocess.check_call(
- ['xrandr', '--output', output, '--rotation', rotation])
+ if os.getenv('XDG_SESSION_TYPE') == 'wayland':
+ subprocess.check_call(
+ ['gnome-randr', 'modify', output, '--rotate', rotation])
+ else:
+ print("setting rotation to {}".format(rotation))
+ subprocess.check_call(
+ ['xrandr', '--output', output, '--rotation', rotation])
time.sleep(8)