MulitMonitor bug
Quick and dirty fix... Script now looks for an external display before trying to rotate the screen. If one is present it will automatically deactivate autorotation of the internal screen.
This commit is contained in:
parent
01f4afddcf
commit
bd6eaf1fb0
|
@ -27,6 +27,13 @@ def refreshtouch():
|
||||||
os.system('xinput disable "NTRG0001:01 1B96:1B05"')
|
os.system('xinput disable "NTRG0001:01 1B96:1B05"')
|
||||||
os.system('xinput enable "NTRG0001:01 1B96:1B05"')
|
os.system('xinput enable "NTRG0001:01 1B96:1B05"')
|
||||||
|
|
||||||
|
def checkdisplays():
|
||||||
|
check_displays = "xrandr | grep -w 'connected'"
|
||||||
|
str_displays = str(subprocess.check_output(check_displays, shell=True).lower().rstrip())
|
||||||
|
list_displays = str_displays.splitlines()
|
||||||
|
int_displays = len(list_displays)
|
||||||
|
return int_displays
|
||||||
|
|
||||||
#PARAMETERS
|
#PARAMETERS
|
||||||
count = 0
|
count = 0
|
||||||
path = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
path = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
@ -57,39 +64,46 @@ firstrun = True
|
||||||
with open(dpath + 'in_accel_scale') as f:
|
with open(dpath + 'in_accel_scale') as f:
|
||||||
scale = float(f.readline())
|
scale = float(f.readline())
|
||||||
while True:
|
while True:
|
||||||
|
multimonitor = False
|
||||||
|
int_displays = checkdisplays()
|
||||||
|
if int_displays > 1:
|
||||||
|
multimonitor = True
|
||||||
time.sleep(1.0/freq)
|
time.sleep(1.0/freq)
|
||||||
previous_state = current_state
|
previous_state = current_state
|
||||||
status = readFile(os.path.join(path, 'status.txt'))
|
status = readFile(os.path.join(path, 'status.txt'))
|
||||||
if str(status[0]) == "on":
|
if str(status[0]) == "on" and multimonitor == False:
|
||||||
with open(dpath + 'in_accel_x_raw', 'r') as fx:
|
with open(dpath + 'in_accel_x_raw', 'r') as fx:
|
||||||
with open(dpath + 'in_accel_y_raw', 'r') as fy:
|
with open(dpath + 'in_accel_y_raw', 'r') as fy:
|
||||||
with open(dpath + 'in_accel_z_raw', 'r') as fz:
|
with open(dpath + 'in_accel_z_raw', 'r') as fz:
|
||||||
thex = float(fx.readline())
|
thex = float(fx.readline())
|
||||||
they = float(fy.readline())
|
they = float(fy.readline())
|
||||||
thez = float(fz.readline())
|
thez = float(fz.readline())
|
||||||
if (thex >= 65000 or thex <=650):
|
if checkdisplays() == 1:
|
||||||
if (they <= 65000 and they >= 64000):
|
if (thex >= 65000 or thex <=650):
|
||||||
os.system(normal)
|
if (they <= 65000 and they >= 64000):
|
||||||
current_state = 0
|
os.system(normal)
|
||||||
if (they >= 650 and they <= 1100):
|
current_state = 0
|
||||||
os.system(inverted)
|
if (they >= 650 and they <= 1100):
|
||||||
current_state = 1
|
os.system(inverted)
|
||||||
if (thex <= 64999 and thex >= 650):
|
current_state = 1
|
||||||
if (thex >= 800 and thex <= 1000):
|
if (thex <= 64999 and thex >= 650):
|
||||||
os.system(right)
|
if (thex >= 800 and thex <= 1000):
|
||||||
current_state = 2
|
os.system(right)
|
||||||
if (thex >= 64500 and thex <=64700):
|
current_state = 2
|
||||||
os.system(left)
|
if (thex >= 64500 and thex <=64700):
|
||||||
current_state = 3
|
os.system(left)
|
||||||
|
current_state = 3
|
||||||
|
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
|
print("ExtDi: " + str(multimonitor))
|
||||||
print("A-ROT: " + status[0])
|
print("A-ROT: " + status[0])
|
||||||
print(" x: " + str(thex))
|
print(" x: " + str(thex))
|
||||||
print(" y: " + str(they))
|
print(" y: " + str(they))
|
||||||
print(" z: " + str(thez))
|
print(" z: " + str(thez))
|
||||||
print(" POS: " + state_dict[current_state])
|
print(" POS: " + state_dict[current_state])
|
||||||
if status[0] == "off":
|
if status[0] == "off" or multimonitor == True:
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
|
print("ExtDi: " + str(multimonitor))
|
||||||
print("A-ROT: " + status[0])
|
print("A-ROT: " + status[0])
|
||||||
print(" x: " + status[0])
|
print(" x: " + status[0])
|
||||||
print(" y: " + status[0])
|
print(" y: " + status[0])
|
||||||
|
|
Loading…
Reference in New Issue