From e4faf1c5bfad5291e608bb189ce9235383f32676 Mon Sep 17 00:00:00 2001 From: Matan Arnon Date: Fri, 31 Dec 2021 12:03:23 +0200 Subject: [PATCH] import xlib.display, use it to determine screen orientation --- howdy/src/compare.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/howdy/src/compare.py b/howdy/src/compare.py index bbfc623..4885156 100644 --- a/howdy/src/compare.py +++ b/howdy/src/compare.py @@ -22,6 +22,7 @@ import subprocess import snapshot import numpy as np import _thread as thread +import Xlib.display as display from i18n import _ from recorders.video_capture import VideoCapture @@ -193,6 +194,14 @@ del lock # Fetch the max frame height max_height = config.getfloat("video", "max_height", fallback=0.0) + +# Get screen orientaion +landscape = True +dsp = display.Display() +screen_width = dsp.screen().width_in_pixels +screen_height = dsp.screen().height_in_pixels +if screen_height > screen_width: + landscape = False # Get the height of the image height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1