我有一个运行树莓派杰西的RPi,我在信息亭模式下使用:我从 /etc/rc.local
/usr/bin/xinit /opt/domotique/xinitrc > /root/xinitrc-errors 2>&1
并且/opt/domotique/xinitrc
是
date > /tmp/date.txt
export DISPLAY=':0'
xset s off
xset -dpms
xset s noblank
setxkbmap fr
/usr/bin/matchbox-window-manager -use_titlebar no -use_cursor no &
# wait for the window manager to start
sleep 10
rm -fr /root/.config /root/.cache
/usr/bin/firefox http://127.0.0.1:8081/infoscreen/infoscreen.html &
# let the browser start
sleep 10
/usr/bin/xte 'mousemove 10000 10000'
sleep 2
/usr/bin/xdotool key F11
date >> /tmp/date.txt
sleep 40000000
这个想法是启动一个最小的窗口管理器,然后是Firefox,然后以编程方式将鼠标移开,然后按F11
进入全屏模式。
一切工作正常,除了F11
没有“按下”键-剩下的是Firefox和其镶边。
如果我SSH到主机并在root提示符下运行
export DISPLAY=':0'
/usr/bin/xdotool key F11
然后将firefox正确切换到全屏。如果我也一样xte
。控制文件/tmp/date.txt
有两个日期行,并且中没有错误/root/xinitrc-errors
。
这种奇怪行为的原因可能是什么?
按键 [选项]按键[按键...]
选项:
-窗口窗口
将击键发送到特定的窗口ID。您可以在此处使用``WINDOW STACK''引用,例如``%1''和``%@''。如果存在窗口堆栈,则默认为``%1'',否则将使用当前窗口。
在ssh
测试中,您已经将Firefox窗口作为焦点,因此它收到了按键。在脚本中,xte mousemove ...
左键不专心。
您可以xdotool search
与其他命令链接。搜索firefox
可能会返回多个窗口。手册页使用了example --classname Navigator
,它适用于我测试过的版本(47.0.1)。失败的话,您可以xprop
用来找到其他特定于相关窗口的字符串。
xdotool search --classname Navigator windowfocus key F11
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句