【问题标题】:Set Discord Web App to run at boot in Raspbian 10 Buster将 Discord Web App 设置为在 Raspbian 10 Buster 中启动时运行
【发布时间】:2021-03-18 01:00:24
【问题描述】:

想让 Discord 在启动时以全屏模式运行。

我正在使用什么:

  • 树莓派 4 8gb
  • Raspbian 10 破坏者
  • Pi 应用程序(当前)分布
  • 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/

无论如何,是否可以编写脚本使其在启动时运行;是否也可以让它自动全屏?

谢谢,

【问题讨论】:

    标签: raspberry-pi discord raspbian-buster


    【解决方案1】:
    1. 创建文件/home/pi/.config/lxsession/LXDE/autostart 和父目录(如果还没有的话):
    $ mkdir -p /home/pi/.config/lxsession/LXDE
    $ touch /home/pi/.config/lxsession/LXDE/autostart
    
    1. 创建脚本:
    $ 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
    
    1. 将脚本添加到自动启动文件中:
    $ echo '@fullscreendiscord' >> /home/pi/.config/lxsession/LXDE/autostart
    
    1. 重新启动以应用更改
    $ 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
    

    【讨论】:

    • 我正在使用 Discord (Web App) 的 Pi-Apps 发行版。按照您的指示(完全有意义)后,它不起作用。我相信这是由于 Pi-Apps 安装 Discord 的一些奇怪方式,因为我找不到实际安装的只有 .desktop 文件。
    • 你可以通过在终端中运行 discord 来启动 Discord 吗?你也可以试试火狐版
    • 您也可以尝试在终端中运行/usr/share/discord-linux-armv7l/discord。如果这个可行,您可以尝试在 /bin/fullscreendiscord 中将 discord & 替换为 /usr/share/discord-linux-armv7l/discord &
    • 如果xdotool apt 包没有进入全屏模式,您还应该确保它已安装。
    • 所以我已经确认安装了 xdotool。我也知道,如果我输入 exec electron-discord-webapp 它将运行,但如果我把它放在 bash 脚本中的 & 之前,我什么也得不到。有任何想法吗?如果它有助于应用程序的路径是 /usr/share/application/electron-discord-webapp (
    猜你喜欢
    • 1970-01-01
    • 2020-10-04
    • 2018-12-31
    • 1970-01-01
    • 1970-01-01
    • 2020-07-30
    • 1970-01-01
    • 2019-11-14
    • 1970-01-01
    相关资源
    最近更新 更多