Jump to content

Plymouth/zh: Difference between revisions

From Official NixOS Wiki
Ardenet (talk | contribs)
Created page with "NixOS 将默认主题设置为 '''bgrt'''$1。您可以使用 `boot.plymouth.theme` 更改主题:"
Tags: Mobile edit Mobile web edit
Ardenet (talk | contribs)
Created page with "=== 安装新主题 ==="
Line 73: Line 73:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Install_new_themes"></span>
=== Install new themes ===
=== 安装新主题 ===
</div>


例如,您可以通过以下代码使用 [https://github.com/adi1090x/plymouth-themes collection] 中的启动动画:
例如,您可以通过以下代码使用 [https://github.com/adi1090x/plymouth-themes collection] 中的启动动画:

Revision as of 16:23, 5 October 2026

Plymouth 是一个在启动过程早期运行的应用程序,提供图形启动动画。它被大多数面向桌面的 Linux 发行版所使用。

准备工作

Plymouth 主要使用 KMS 来显示图形,但在 UEFI 系统上,它也可以利用 EFI 帧缓冲区。

如果没有 KMS 或帧缓冲(framebuffer),Plymouth 将回退到文本模式。[1]

安装

基础配置

{
  boot = {
    plymouth = {
      enable = true;
    };

    # Enable "Silent boot"
    consoleLogLevel = 3;
    initrd.verbose = false;
    kernelParams = [
      "quiet"
      "rd.udev.log_level=3"
      "rd.systemd.show_status=auto"
    ];

    # Hide the OS choice for bootloaders.
    # It's still possible to open the bootloader list by pressing any key
    # It will just not appear on screen unless a key is pressed
    loader.timeout = 0;
  };
}

配置

改变主题

Plymouth 附带了一系列主题:

  1. BGRT: Spinner 的变体,若可用则保留 OEM 徽标(BGRT 代表 Boot Graphics Resource Table,即启动图形资源表)
  2. Fade-in: “简约主题,伴随闪烁星光进行淡入淡出效果”
  3. Glow: “商务风格主题,包含饼图形式的启动进度显示,随后呈现发光的浮现徽标”
  4. Script: “脚本示例插件”(尽管描述如此,但这实际上是一个相当不错的 Arch 徽标主题)
  5. Solar: “太空主题,包含一颗剧烈耀斑喷发的蓝色恒星”
  6. Spinner: “简约主题,包含一个加载旋转动画”
  7. Spinfinity: “简约主题,在屏幕中央显示一个旋转的无穷大符号”
  8. Tribar: “文本模式主题,包含三色进度条”
  9. Text: “文本模式主题,包含三色进度条”
  10. Details: “显示详细信息的备用主题”

NixOS 将默认主题设置为 bgrt[2]。您可以使用 `boot.plymouth.theme` 更改主题:

{
  boot = {
    plymouth = {
      enable = true;
      theme = "solar";
    };
  };
}

安装新主题

例如,您可以通过以下代码使用 collection 中的启动动画:

❄︎ configuration.nix
{ pkgs, ... }: {
  boot = {
    plymouth = {
      enable = true;
      theme = "rings";
      themePackages = with pkgs; [
        # 默认情况下,我们会安装所有主题。
        (adi1090x-plymouth-themes.override {
          selected_themes = [ "rings" ];
        })
      ];
    };

    # 启用“静默启动”
    consoleLogLevel = 3;
    initrd.verbose = false;
    kernelParams = [
      "quiet"
      "rd.udev.log_level=3"
      "rd.systemd.show_status=auto"
    ];

    # 隐藏引导加载程序的操作系统选择选项。
    # 仍然可以通过按任意键打开引导加载程序列表。
    # 除非按下某个键,否则它不会显示在屏幕上。
    loader.timeout = 0;
  };
}

HiDPI

Edit the configuration file:

{
  boot = {
    plymouth = {
      enable = true;
      extraConfig = ''
        [Daemon]
        DeviceScale=an-integer-scaling-factor
      '';
    };
  };
}

Tips and tricks

Show boot messages

在图形界面启动过程中,可以用退出键(或者说 ESC)在文本模式和 Playmouth 界面中切换。

Troubleshooting

LUKS Encryption

如果您使用 LUKS 加密,密码提示可能会回退到文本模式。虽然默认的 bgrt 主题支持图形化密码输入,但并非所有主题都支持此功能。

See Also