modify xrandr

This commit is contained in:
jaydee
2024-02-15 06:55:53 +01:00
parent 1c726c376c
commit 4edb522e5e
10 changed files with 83 additions and 73 deletions

View File

@@ -19,7 +19,7 @@ import random
import requests
#import psutil
stats = {}
VERSION = "1.0.25"
VERSION = "1.0.26"
curos = platform.system()
host = platform.node().lower()
print(host)
@@ -789,9 +789,9 @@ def on_message(client, userdata, msg):
mon3 = "DVI-I-2-1"
mon4 = "eDP-1-1"
'''
left = ["HDMI-A-0", "1920x1080"]
mid = ["DisplayPort-0", "2560x1440"]
right = ["DisplayPort-1", "3440x1440"]
right = ["HDMI-A-0", "1920x1080"]
left = ["DisplayPort-0", "2560x1440"]
mid = ["DisplayPort-1", "3440x1440"]
if myObj["target"] == "mid":
@@ -819,6 +819,8 @@ def on_message(client, userdata, msg):
myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --output {right[0]} --auto --right-of {mid[0]} --mode {right[1]} --output {left[0]} --auto --left-of {mid[0]} --mode {left[1]}"
elif myObj["target"] == "build":
myCmd = f"xrandr --output {mid[0]} --off --output {right[0]} --off --output {left[0]} --off"
elif myObj["target"] == "leftright":
myCmd = f"xrandr --output {left[0]} --primary --auto --mode {left[1]} --output {mid[0]} --off --output {right[0]} --auto --right-of {left[0]} --mode {right[1]}"
else:
pass
@@ -1108,7 +1110,7 @@ else:
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on", "version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":"' + str(fan_data) + '", "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on", "version":"' + VERSION + '","TCPU":"NA", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":"' + str(fan_data) + '", "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
elif host.lower() == "openmediavault" or host.lower() == "omv":
#print(psutil.sensors_temperatures())