【发布时间】:2022-06-20 09:03:36
【问题描述】:
我希望能够从我的 python 脚本中检测 KDE 中的活动屏幕。以前我用 Xlib 并像这样用鼠标寻找屏幕:
from Xlib import display
def mousepos():
data = display.Display().screen().root.query_pointer()._data
return data["root_x"], data["root_y"]
current_pos = mousepos()
x_pos = current_pos[0]
y_pos = current_pos[1]
names_handling_y = []
names_handling_x = []
...
if x_pos >= output["pos"]["x"] and x_pos <= output["pos"]["x"] + output["size"]["width"]:
names_handling_x.append(output["name"])
if y_pos >= output["pos"]["y"] and y_pos <= output["pos"]["y"] + output["size"]["height"]:
names_handling_y.append(output["name"])
...
for name in names_handling_x:
if name in names_handling_y:
target_output = name
但是在使用 Wayland 时我该如何做类似的事情呢?
【问题讨论】:
标签: python x11 kde-plasma wayland