问题描述
希望让 Discord 在启动时以全屏模式运行。
我正在使用什么:
- 树莓派 4 8GB
- 树莓派 10 克星
- Pi Apps(当前)分布
- Discord WebApp(当前)
我尝试过的:
- rc.local
- .bash
- init.d
不确定我是不是按照指示做错了,还是因为它是桌面应用程序而不是 .py?
作为参考,我尝试按照以下说明插入:
usr/shr/applications/electron-dsicord-webapp.desktop
它列出 sample.py
的地方
https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/
无论如何,是否可以编写脚本使其在启动时运行;是否也可以让它自动全屏?
谢谢,
解决方法
- 创建文件
/home/pi/.config/lxsession/LXDE/autostart
和父目录(如果尚不存在):
$ mkdir -p /home/pi/.config/lxsession/LXDE
$ touch /home/pi/.config/lxsession/LXDE/autostart
- 创建脚本:
$ sudo nano /bin/fullscreendiscord
然后添加以下内容:
#!/bin/bash
# open Discord in the background
discord &
# find Discord and then execute ctrl+shift+F (fullscreen on Discord)
sleep 6 ; xdotool search --sync --onlyvisible --class "Discord" windowactivate key ctrl+shift+F
- 将脚本添加到自动启动文件:
$ echo '@fullscreendiscord' >> /home/pi/.config/lxsession/LXDE/autostart
- 重新启动以应用更改
$ sudo reboot
注意:
我希望您将 Discord 安装为桌面应用程序
如果你想在 Firefox 上运行 discord,请将 /bin/fullscreendiscord 替换为
#!/bin/bash
# open Firefox with Discord open in the background
firefox https://discord.com/app &
# find Firefox and then execute F11
sleep 1 ; xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F11