gpt4 book ai didi

linux - 试图运行 xdotool 但得到 'Can' t open display : (null)'

转载 作者:行者123 更新时间:2023-12-03 09:58:53 34 4
gpt4 key购买 nike

我很抱歉再次报告这个众所周知的错误消息。
没有什么对我有用。我在 MacOS Catalina 上运行,如果它很重要的话。
我安装了 xdotoolbrew在我的 Mac 上尝试运行

xdotool getmouselocation
下面的错误信息是
Error: Can't open display: (null)
Failed creating new xdo instance
我一直在寻找解决方案,找到了很多答案。运行 export DISPLAY=:0一切都很好。但这对我不起作用。
PS:为了更好地理解:DISPLAY 到底是什么意思?是我电脑的显示器吗?

最佳答案

根据 official notice by apple

X11 is no longer included with Mac, but X11 server and client libraries are available from the XQuartz project.


为什么 X11 在这种情况下很重要?
xdotool - 命令行 X11 自动化工具。
所以除了设置 export DISPLAY=:0安装 xquartz .
DISPLAY 究竟是什么意思?
根据 x manual

From the user's perspective, every X server has a display name of the form:

               hostname:displaynumber.screennumber

This information is used by the application to determine how it shouldconnect to the server and which screen it should use by default (ondisplays with multiple monitors):

  1. hostnameThe hostname specifies the name of the machine to which the display is physically connected. If the hostname is not given, themost efficient way of communicating to a server on the same machinewill be used.

  2. displaynumberThe phrase "display" is usually used to refer to collection of monitors that share a common keyboard and pointer (mouse, tablet,etc.). Most workstations tend to only have one keyboard, andtherefore, only one display. Larger, multi-user systems, however,frequently have several displays so that more than one person can bedoing graphics work at once. To avoid confusion, each display on amachine is assigned a display number (beginning at 0) when the Xserver for that display is started. The display number must always begiven in a display name.

  3. screennumberSome displays share a single keyboard and pointer among two or more monitors. Since each monitor has its own set of windows, eachscreen is assigned a screen number (beginning at 0) when the X serverfor that display is started. If the screen number is not given, screen0 will be used.


找到了更简单的描述 here
显示包括(简化):
  • 一个键盘
  • 一只老鼠
  • 一屏

  • 即当您通过 ssh 连接时,您使用的是这 3 个的不同集合。

    关于linux - 试图运行 xdotool 但得到 'Can' t open display : (null)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59130078/

    34 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com