站长推广工具,wordpress如何建立网站,企业网站建设发展平台,wordpress连接公众号X11相关参数设置 X11环境变量DISPLAY用来设置将图形显示到何处。变量格式 Xlib: connection to :0.0 refused by server开关闭屏幕显示连接实际屏幕确认实际屏幕的name of display 也就是DISPLAY的值是多少设置旋转 触摸屏重定向0、触摸屏重定向1、安装屏幕校准器2… X11相关参数设置 X11环境变量DISPLAY用来设置将图形显示到何处。变量格式 Xlib: connection to :0.0 refused by server开关闭屏幕显示连接实际屏幕确认实际屏幕的name of display 也就是DISPLAY的值是多少设置旋转 触摸屏重定向0、触摸屏重定向1、安装屏幕校准器2、查看屏幕分辨率3、手动设置校准窗口的大小有多个显示器而只有一个触摸屏时用的用于设置只指定窗口4、按提示说明 拷贝校正信息到下面的文件中5、完成。、查看 xinput_calibrator 使用方法、查看输入设备、查看输出设备 X11
环境变量DISPLAY用来设置将图形显示到何处。
直接登陆图形界面或者登陆命令行界面后使用startx启动图形, DISPLAY环境变量将自动设置为:0:0
变量格式
DISPLAY 环境变量格式如下host:NumA.NumB,
host指Xserver所在的主机主机名或者ip地址, 图形将显示在这一机器上, 可以是启动了图形界面的Linux/Unix机器, 也可以是安装了Exceed, X-Deep/32等Windows平台运行的Xserver的Windows机器. 如果Host为空, 则表示Xserver运行于本机, 并且图形程序(Xclient)使用unix socket方式连接到Xserver, 而不是TCP方式. 使用TCP方式连接时, NumA为连接的端口减去6000的值, 如果NumA为0, 则表示连接到6000端口; 使用unix socket方式连接时则表示连接的unix socket的路径, 如果为0, 则表示连接到/tmp/.X11-unix/X0 . NumB则几乎总是0
Xlib: connection to “:0.0” refused by server
Xlib: No protocol specifiedr Error: Can’t open display: :0.0
这是因为Xserver默认情况下不允许别的用户的图形程序的图形显示在当前屏幕上. 如果需要别的用户的图形显示在当前屏幕上, 则应以当前登陆的用户, 也就是切换身份前的用户执行如下命令
xhost 实例
#切换用户前是root用户在使用图形程序
su - rootxhost su - oracleroot与oracle用户的DISPLAY都为:0.0xhost 是用来控制X server访问权限的。 通常当你从hostA登陆到hostB上运行hostB上的应用程序时做为登录与被登录来说hostA是client但是对图形来说是在hostA上显示的需要使用hostA的Xserver所以hostA是server。
因此在登陆到hostB前需要在hostA上运行xhost 来使其它用户能够访问hostA的Xserver。
开关闭屏幕显示
#ubuntu16.04关掉图形界面启动命令
systemctl disable lightdm.service#开启图形界面命令
ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service重置
sudo dpkg-reconfigure lightdm其他
关闭图形界面
1.不可恢复
sudo systemctl disable lightdm.service
2.可恢复
sudo systemctl set-default multi-user.target打开图形界面分别针对上述1和2
1
sudo apt-get install --reinstall lightdm
2
sudo systemctl set-default graphical.target连接实际屏幕
确认实际屏幕的name of display 也就是DISPLAY的值是多少
要求在实际显示屏幕上运行
xdpyinfo |grep name不同的登录会造成不同结果切记一定要登录在实际屏幕上运行
xhost
#运行结果access control disabled, clients can connect from any host那么实际屏幕可以被其他登录端使用比如ssh端登录 运行xdpyinfo |grep name结果为 那么运行打开带ui的界面程序不会显示到实际屏幕如需映射到实际屏幕需执行以下指令
#实际屏幕端允许任意连接 或者加号后面带ip地址指定ip可以连接
xhost #ssh端设置DISPLAY,指定图形连接到localhost:0.0这里也就是我们在实际屏幕端查到的信息
export DISPLAY:0.0
#以上没有错误再ssh端运行需要的程序即可显示到实际屏幕端
xxx设置旋转
xrandr -o left 向左旋转90度
xrandr -o right 向右旋转90度
xrandr -o inverted 上下翻转
xrandr -o normal 回到正常角度
#通过xrandr读取显示屏id 为DSI-1指定他旋转
xrandr --output DSI-1 --rotate left触摸屏重定向
ubuntu多显示器单触摸屏校准
0、触摸屏重定向
sudo xinput map-to-output 13 DP1 #将触摸屏映射到指定的显示器13为触摸屏设备id可通过xinput命令查看ILITEK ILITEK-TP id13 [slave pointer (2)] DP1为指定的显示设备名可通过xrandr命令查看
1、安装屏幕校准器
sudo apt-get install xinput-calibrator2、查看屏幕分辨率
在System settings -- Display 查看屏幕分辨率
3、手动设置校准窗口的大小有多个显示器而只有一个触摸屏时用的用于设置只指定窗口
我的电脑有两个显示器一个1920x1080 一个1024x768我只校准左边的显示器如 Usage:xinput_calibrator --geometry x –geometry: manually provide the geometry (width and height) for the calibration window sudo xinput_calibrator --geometry 1920x1080
#注意1920x1080 此处是字母x Warning: multiple calibratable devices found, calibrating last one (ILITEK ILITEK-TP) use --device to select another one. Setting calibration data: 0, 16384, 0, 9600 Calibrating EVDEV driver for “ILITEK ILITEK-TP” id14 current calibration values (from XInput): min_x0, max_x16384 and min_y0, max_y9600 Doing dynamic recalibration: Setting calibration data: 82, 32942, 155, 9796 – Making the calibration permanent – copy the snippet below into ‘/etc/X11/xorg.conf.d/99-calibration.conf’ (/usr/share/X11/xorg.conf.d/ in some distro’s) Section “InputClass” Identifier “calibration” MatchProduct “ILITEK ILITEK-TP” Option “Calibration” “82 32942 155 9796” Option “SwapAxes” “0” EndSection 我的电脑是在/usr/share/X11/xorg.conf.d/目录下
4、按提示说明 拷贝校正信息到下面的文件中
sudo gedit /usr/share/X11/xorg.conf.d/99-calibration.conf将下面的内容拷贝进去 Section “InputClass” Identifier “calibration” MatchProduct “ILITEK ILITEK-TP” Option “Calibration” “82 32942 155 9796” Option “SwapAxes” “0” EndSection 5、完成。
、查看 xinput_calibrator 使用方法
xinput_calibrator -hxinput_calibrator, v0.7.5 Usage: xinput_calibrator [-h|–help] [-v|–verbose] [–list] [–device ] [–precalib ] [–misclick ] [–output-type auto|xorg.conf.d|hal|xinput] [–fake] [–geometry x] [–no-timeout] -h, --help: print this help message -v, --verbose: print debug messages during the process –list: list calibratable input devices and quit –device device name or XID or sysfs event name (e.g event5): select a specific device to calibrate –precalib: manually provide the current calibration setting (eg. the values in xorg.conf) –misclick: set the misclick threshold (0off, default: 15 pixels) –output-type auto|xorg.conf.d|hal|xinput: type of config to output (autoautomatically detect, default: auto) –fake: emulate a fake device (for testing purposes) –geometry: manually provide the geometry (width and height) for the calibration window –no-timeout: turns off the timeout –output-filename: write calibration data to file (USB: override default /etc/modprobe.conf.local 、查看输入设备
xinput⎡ Virtual core pointer id2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id4 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver id11 [slave pointer (2)] ⎜ ↳ ILITEK ILITEK-TP id13 [slave pointer (2)] ⎜ ↳ ILITEK ILITEK-TP id14 [slave pointer (2)] ⎣ Virtual core keyboard id3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id5 [slave keyboard (3)] ↳ Power Button id6 [slave keyboard (3)] ↳ Video Bus id7 [slave keyboard (3)] ↳ Power Button id8 [slave keyboard (3)] ↳ Sleep Button id9 [slave keyboard (3)] ↳ Logitech USB Receiver id10 [slave keyboard (3)] ↳ USB2.0 Camera id12 [slave keyboard (3)] 、查看输出设备
xrandrScreen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767 DP1 connected primary 1920x108000 (normal left inverted right x axis y axis) 521mm x 293mm 1920x1080 60.0* 1680x1050 60.0 1280x1024 75.0 60.0 1440x900 59.9 1280x960 60.0 1280x720 60.0 1024x768 75.1 70.1 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 640x480 75.0 72.8 66.7 60.0 720x400 70.1 HDMI1 disconnected (normal left inverted right x axis y axis) HDMI2 disconnected (normal left inverted right x axis y axis) VIRTUAL1 disconnected (normal left inverted right x axis y axis) 实例参考