在树莓派 4 型号上启动时无法打开 chrome 选项卡

问题描述 投票:0回答:1

我尝试在树莓派启动时打开 2 个 chrome 窗口。我编写了一个包含以下内容的 bash 脚本:

#!/bin/bash
PROFILE_PATH1="/home/screen/.config/chromium/Profile1"
PROFILE_PATH2="/home/screen/.config/chromium/Profile2"
# Open Chrome windows on startup
chromium-browser --user-data-dir=$PROFILE_PATH1 https://example.com/tab1 &
chromium-browser --user-data-dir=$PROFILE_PATH2 https://example.com/tab2

我尝试使用

bash open_chrome_tabs.sh
手动运行此命令,效果很好。所以我将它添加到
/etc/xdg/lxsession/LXDE-pi/autostart
,现在它看起来像这样:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@bash /home/screen/open_chrome_tabs.sh

但是重新启动 pi 后,没有打开 chrome 窗口。

我在网上查找了一些可能的解决方案。我尝试在 bash 脚本中添加 40 秒的 bash sleep 命令,但是在启动后等待 40 秒后......什么也没有。

我还尝试通过将文件更改为如下所示,从自动启动文件运行 galculator:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@galculator

但是重启后,计算器无法启动。我尝试手动运行 galculator,效果也很好。如果一切都失败了,我会尝试使用 crontab (虽然从未使用过它),但我很想知道我做错了什么,任何帮助将不胜感激。谢谢你!

bash raspberry-pi autostart
1个回答
0
投票

问题解决了!结果发现 pi 使用的显示服务器是 wayland。我切换到x11,然后上面的脚本执行得很好

© www.soinside.com 2019 - 2024. All rights reserved.