Keep boot logo at original dimensions

This means that the OEM logo can be used to have a seamless boot process.
(Copy it in PNG format from /sys/firmware/acpi/bgrt/image)

The width of the progress bar will be adjusted to suit the width of the logo.
This commit is contained in:
Daniel Thwaites 2022-10-06 14:56:39 +01:00
parent 1d61691bf9
commit 16ecd5523a
No known key found for this signature in database
GPG key ID: D8AFC4BF05670F9D
2 changed files with 11 additions and 10 deletions

View file

@ -52,7 +52,13 @@ in {
defaultText = literalDocBook "NixOS snowflake";
default = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nix-snowflake.svg";
sha256 = "SCuQlSPB14GFTq4XvExJ0QEuK2VIbrd5YYKHLRG/q5I=";
# Reduce size
postFetch = ''
substituteInPlace $out \
--replace "141.5919" "70.79595" \
--replace "122.80626" "61.40313"
'';
sha256 = "4+MWdqESKo9omd3q0WfRmnrd3Wpe2feiayMnQlA4izU=";
};
};

View file

@ -1,6 +1,5 @@
center_x = Window.GetWidth() / 2;
center_y = Window.GetHeight() / 2;
baseline_y = (Window.GetHeight() / 3) * 2;
### BACKGROUND ###
@ -11,13 +10,7 @@ Window.SetBackgroundBottomColor(%BASE00%);
### LOGO ###
logo.original_image = Image("logo.png");
if (logo.original_image.GetHeight() > 200) {
logo.ratio = logo.original_image.GetWidth() / logo.original_image.GetHeight();
logo.image = logo.original_image.Scale(Math.Int(200 * logo.ratio), 200);
} else {
logo.image = logo.original_image;
}
logo.image = Image("logo.png");
logo.sprite = Sprite(logo.image);
logo.sprite.SetPosition(
center_x - (logo.image.GetWidth() / 2),
@ -25,10 +18,12 @@ logo.sprite.SetPosition(
1
);
baseline_y = center_y + logo.image.GetHeight();
### PROGRESS ###
progress_background.width = 200;
progress_background.width = Math.Int(logo.image.GetWidth() * 0.65);
progress_background.height = 6;
progress_background.original_image = Image("progress-background.png");
progress_background.image = progress_background.original_image.Scale(progress_background.width, progress_background.height);