再次关于平板电脑的第二个显示器......

我发现自己拥有这样一款普通的平板电脑,传感器无法正常工作(我的大儿子尽了最大努力),我想了很长时间来适应它。 谷歌搜索,谷歌搜索和谷歌搜索(时间, ,黑客第 227 号),以及许多其他食谱 空间台, 爱迪普拉 和其他一些。 唯一的问题是我有Linux。 经过更多的谷歌搜索后,我找到了几个食谱,并通过一些简单的萨满教我得到了可接受的结果。

再次关于平板电脑的第二个显示器......
我的方法是下面切的。

你将需要:

Linux 已安装:

  • x11vnc (坦白说我不喜欢各种 TigerVNC 和其他)
  • 亚洲开发银行 来自 android-tools 套件

启用调试模式并设置为的平板电脑/智能手机:

  • Android雷士 (我有这个,因为没有广告)
  • 某种屏幕消隐拦截器(我找不到没有广告的拦截器)
  • 任何自动加载器(运行 VNC 和阻止程序)都是可选的(更多内容见下文)。

好的,我们开始吧。

1. 获取 xorg.conf 的 Modeline

$ cvt 1024 768 25 # Можно и gtf, но он не всегда дает корректный modeline.

2. 编辑

配置文件

Section "ServerLayout"
        Identifier     "Xorg Configured" 
        Screen         0  "Monitor" 0 0
        Screen         2  "Screen2" rightof "Screen0" # "Пустышка для VNC"
        Option         "Xinerama" "1"
	EndSection
	#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # здесь все настройки оборудования, коли таковые есть
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	#Dummy видеокарта
	Section "Device"
		Identifier "Device2"
		Driver "dummy"
 		VideoRam 8000
	EndSection

	#Dummy монитор
	Section "Monitor"
 		Identifier "Monitor2"
  		Modeline "1024x768@25" 23.77 1024 1056 1144 1176 768 785 789 807 # см. п. 1
	EndSection 

	#Dummy экран
	Section "Screen"
 		Identifier "Screen2"
 		Device "Device2"
 		Monitor "Monitor2"
 		DefaultDepth 24
 		SubSection "Display"
	#разрешение плашета
    		Modes      "1024x768"
    		Virtual 1024 748
    	EndSubSection
	EndSection

我们重新启动X-sys并通过arandr进行检查。 设置位置和方向。它应该看起来像这样:

再次关于平板电脑的第二个显示器......

我们将其保存到文件中 - 这对我们很有用。

3.创建一个在WM/DE中自动加载的文件(我有planshet.sh)

x11vnc -rfbport 5900 -display :0 -dontdisconnect -noxfixes -xdamage -shared -forever -clip 1024x768+1600+0 -scale 1024x768 -bg -cursor X -o /home/$USER/x11vnc.log -repeat
	xrandr --addmode VIRTUAL1 1024x768 # необязательно
	xrandr --output VIRTUAL1 --mode 1024x768 # необязательно
	xrandr --output VIRTUAL2 --off --output HDMI1 --off --output VIRTUAL1 --mode 1024x768 --pos 1602x0 --rotate normal --output DP1 --off --output VGA1 --mode 1600x900 --pos 0x0 --rotate normal #вот эта строка заимствована из сохраненного файла arandr

检查:

$ xrandr |grep VIRTUAL1
        VIRTUAL1 connected 1024x768+1600+0 (normal left inverted right x axis y axis) 0mm x 0mm

由于 IceWM 中没有自动启动目录,但有一个文件 ~/.icewm/startup (应该是可执行的),因此在其中添加以下内容:

sh -c /path/to/planshet.sh

4. 禁用监视器消隐:

	xset s off
	xset s noblank
	xset -dpms

有趣的来了! 如何在不使用“试错法”的情况下通过折磨控制台中的键盘来获取设备的“点击”坐标?!

为了这样的事情我雕刻了 程序。 如果我们从控制台运行它,我们将得到我们正在寻找的东西 - 点击坐标的输出。

再次关于平板电脑的第二个显示器......

6. 让我们将所有这些添加到 planshet.sh 中

完整版

#!/bin/bash
       x11vnc -rfbport 5900 -display :0 -dontdisconnect -noxfixes -xdamage -shared -forever -clip 1024x768+1600+0 -scale 1024x768 -bg -cursor X -o /home/$USER/x11vnc.log -repeat
	xrandr --addmode VIRTUAL1 1024x768 # необязательно
	xrandr --output VIRTUAL1 --mode 1024x768 # необязательно
	xrandr --output VIRTUAL2 --off --output HDMI1 --off --output VIRTUAL1 --mode 1024x768 --pos 1602x0 --rotate normal --output DP1 --off --output VGA1 --mode 1600x900 --pos 0x0 --rotate normal  #вот эта строка заимствована из сохраненного файла arandr
	xset s off
	xset s noblank
	xset -dpms
	adb tcpip 5555
	adb connect 192.168.0.14:5555
	sudo adb devices
	adb shell input tap 1000 20 # тапаем по "квадратикам" в правом верхнем углу (не знаю, как нызавется) - скрин 3
	adb shell input tap 392 138 # тапаем по AndroidVNC
	adb shell input tap 20 65 # запускаем VNC предварительно прописав адрес и порт

我们会做到的

chmod +x /path/to/planshet.sh

事实上,仅此而已。 重新启动 X 服务器并获得多屏幕。

我的“小”机器上有 Conky 运行。

附上双屏的截图。

再次关于平板电脑的第二个显示器......

当我建模时,我也会将数据表扔到上面。

来源: habr.com

添加评论