0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-19 09:51:19 +02:00

import xlib.display, use it to determine screen orientation

This commit is contained in:
Matan Arnon 2021-12-31 12:03:23 +02:00
parent fbde12bb13
commit e4faf1c5bf

View file

@ -22,6 +22,7 @@ import subprocess
import snapshot import snapshot
import numpy as np import numpy as np
import _thread as thread import _thread as thread
import Xlib.display as display
from i18n import _ from i18n import _
from recorders.video_capture import VideoCapture from recorders.video_capture import VideoCapture
@ -193,6 +194,14 @@ del lock
# Fetch the max frame height # Fetch the max frame height
max_height = config.getfloat("video", "max_height", fallback=0.0) 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 # Get the height of the image
height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1 height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1