搜索

13.9. 单应用程序模式

download PDF
单应用程序模式是修改的 shell,可将 shell 重新配置为交互式 kiosk。管理员锁定一些行为,来使标准桌面对用户有更严格的限制,从而使他们专注于所选的功能。
在多个领域(从通信到娱乐或教育)为各种功能设置单应用程序模式,并将其用作自助服务机、事件管理器、注册点等。

过程 13.9. 设置单应用程序模式

  1. 使用以下内容创建以下文件:
    • /usr/bin/redhat-kiosk
      
      #!/bin/sh
      
      if [ ! -e ~/.local/bin/redhat-kiosk ]; then
          mkdir -p ~/.local/bin ~/.config
          cat > ~/.local/bin/redhat-kiosk << EOF
      #!/bin/sh
      # This script is located in ~/.local/bin.
      # It's provided as an example script to show how
      # the kiosk session works.  At the moment, the script
      # just starts a text editor open to itself, but it
      # should get customized to instead start a full screen
      # application designed for the kiosk deployment.
      # The "while true" bit just makes sure the application gets
      # restarted if it dies for whatever reason.
      
      while true; do
          gedit ~/.local/bin/redhat-kiosk
      done
      
      EOF
      
          chmod +x ~/.local/bin/redhat-kiosk
          touch ~/.config/gnome-initial-setup-done
      fi
      
      exec ~/.local/bin/redhat-kiosk "$@"
      
      重要
      /usr/bin/redhat-kiosk 文件必须是可执行的。
      gedit ~/.local/bin/redhat-kiosk 代码替换为您要在 kiosk 会话中执行的命令。这个示例启动了一个为 kiosk 部署而设计的全屏应用程序,名为 http://mine-kios-web-app
      [...]
      while true; do
          firefox --kiosk http://mine-kios-web-app
      done
      [...]
      
    • /usr/share/applications/com.redhat.Kiosk.Script.desktop
      [Desktop Entry]
      Name=Kiosk
      Type=Application
      Exec=redhat-kiosk
      
    • /usr/share/applications/com.redhat.Kiosk.WindowManager.desktop
      [Desktop Entry]
      Type=Application
      Name=Mutter
      Comment=Window manager
      Exec=/usr/bin/mutter
      Categories=GNOME;GTK;Core;
      OnlyShowIn=GNOME;
      NoDisplay=true
      X-GNOME-Autostart-Phase=DisplayServer
      X-GNOME-Provides=windowmanager;
      X-GNOME-Autostart-Notify=true
      X-GNOME-AutoRestart=false
      X-GNOME-HiddenUnderSystemd=true
      
    • /usr/share/gnome-session/sessions/redhat-kiosk.session
      [GNOME Session]
      Name=Kiosk
      RequiredComponents=com.redhat.Kiosk.WindowManager;com.redhat.Kiosk.Script;
      
    • /usr/share/xsessions/com.redhat.Kiosk.desktop
      [Desktop Entry]
      Name=Kiosk
      Comment=Kiosk mode
      Exec=/usr/bin/gnome-session --session=redhat-kiosk
      DesktopNames=Red-Hat-Kiosk;GNOME;
      
  2. 重启 GDM 服务:
    systemctl restart gdm.service
  3. 为 kiosk 会话创建一个单独的用户,并选择 Kiosk 作为 kiosk 会话的用户的会话类型。

    图 13.1. 选择 kiosk 会话

    选择 kiosk 会话
通过启动 Kiosk 会话,用户将启动一个专为 kiosk 部署而设计的全屏应用程序,。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.