从 linux 服务启动全屏 firefox
Start fullscreen firefox from linux service
我想在启动时启动全屏 firefox 实例。我创建了两个服务:
启动 firefox 的服务:
[Unit]
Description=Service running firefox
After=network.target
[Service]
Type=simple
User=me
Environment="DISPLAY=:0"
ExecStart=/usr/bin/firefox --new-window /usr/local/src/index.html
Restart=on-failure
RestartSec=1
TimeoutSec=60
RuntimeMaxSec=infinity
[Install]
WantedBy=multi-user.target
然后我有一个服务发送 F11 命令来启用全屏。 (我没能通过单一服务完成所有事情)
[Unit]
Description=Service for firefox fullscreen
After=network.target start_firefox
BindsTo=start_firefox
[Service]
Type=simple
User=me
Environment="DISPLAY=:0"
ExecStart=/usr/bin/xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F11
Restart=on-failure
RestartSec=1
TimeoutSec=60
RuntimeMaxSec=infinity
[Install]
WantedBy=multi-user.target
然而,它不起作用。我从第二个服务获得的日志是:
systemd[1]: Started Service for firefox fullscreen
xdotool[6268]: Error: Can't open display: (null)
xdotool[6268]: Failed creating new xdo instance
systemd[1]: firefox_fullscreen.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: firefox_fullscreen.service: Failed with result 'exit-code'.
systemd[1]: firefox_fullscreen.service: Service hold-off time over, scheduling restart.
systemd[1]: firefox_fullscreen.service: Scheduled restart job, restart counter is at 4.
systemd[1]: Stopped Service for firefox fullscreen
我做错了什么?
我正在尝试 运行 使用 ubuntu 在板上通过 ssh 并连接到屏幕。
只需使用“firefox --kiosk”,它就会自动全屏启动
我想在启动时启动全屏 firefox 实例。我创建了两个服务:
启动 firefox 的服务:
[Unit]
Description=Service running firefox
After=network.target
[Service]
Type=simple
User=me
Environment="DISPLAY=:0"
ExecStart=/usr/bin/firefox --new-window /usr/local/src/index.html
Restart=on-failure
RestartSec=1
TimeoutSec=60
RuntimeMaxSec=infinity
[Install]
WantedBy=multi-user.target
然后我有一个服务发送 F11 命令来启用全屏。 (我没能通过单一服务完成所有事情)
[Unit]
Description=Service for firefox fullscreen
After=network.target start_firefox
BindsTo=start_firefox
[Service]
Type=simple
User=me
Environment="DISPLAY=:0"
ExecStart=/usr/bin/xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F11
Restart=on-failure
RestartSec=1
TimeoutSec=60
RuntimeMaxSec=infinity
[Install]
WantedBy=multi-user.target
然而,它不起作用。我从第二个服务获得的日志是:
systemd[1]: Started Service for firefox fullscreen
xdotool[6268]: Error: Can't open display: (null)
xdotool[6268]: Failed creating new xdo instance
systemd[1]: firefox_fullscreen.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: firefox_fullscreen.service: Failed with result 'exit-code'.
systemd[1]: firefox_fullscreen.service: Service hold-off time over, scheduling restart.
systemd[1]: firefox_fullscreen.service: Scheduled restart job, restart counter is at 4.
systemd[1]: Stopped Service for firefox fullscreen
我做错了什么?
我正在尝试 运行 使用 ubuntu 在板上通过 ssh 并连接到屏幕。
只需使用“firefox --kiosk”,它就会自动全屏启动