- Add a script-module Plymouth theme: the moon breathes over a progress bar - The bar eases towards the last boot's duration (60 s before one is recorded) - Art is SVG under boot/plymouth, rendered to PNG by render.sh (needs rsvg-convert)
This commit is contained in:
1 parent
019c9ada6c
commit
f910aa2a94
9 files changed
+128
No files matched your search
@@ -0,0 +1,8 @@
|
|||||||
|
[Plymouth Theme]
|
||||||
|
Name=Chandra
|
||||||
|
Description=The Chandra moon over a boot progress bar
|
||||||
|
ModuleName=script
|
||||||
|
|
||||||
|
[script]
|
||||||
|
ImageDir=/usr/share/plymouth/themes/chandra
|
||||||
|
ScriptFile=/usr/share/plymouth/themes/chandra/chandra.script
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# Chandra boot splash: the moon, and a progress bar under it while booting.
|
||||||
|
#
|
||||||
|
# Plymouth estimates the progress from how long the last boot took (/var/lib/plymouth/boot-duration;
|
||||||
|
# 60 s until it has seen one boot). The bar eases towards that estimate and never moves backwards.
|
||||||
|
|
||||||
|
Window.SetBackgroundTopColor(0.086, 0.129, 0.243); # #16213e
|
||||||
|
Window.SetBackgroundBottomColor(0.043, 0.063, 0.125); # #0b1020
|
||||||
|
|
||||||
|
center_x = Window.GetX() + Window.GetWidth() / 2;
|
||||||
|
center_y = Window.GetY() + Window.GetHeight() * 0.44;
|
||||||
|
|
||||||
|
# The art is sized for a 1080 px wide panel; scale it on anything else.
|
||||||
|
art_scale = Window.GetWidth() / 1080;
|
||||||
|
if (Window.GetHeight() < Window.GetWidth()) art_scale = Window.GetHeight() / 1080;
|
||||||
|
|
||||||
|
fun load(name) {
|
||||||
|
local.image = Image(name);
|
||||||
|
if (art_scale == 1) return image;
|
||||||
|
return image.Scale(Math.Int(image.GetWidth() * art_scale), Math.Int(image.GetHeight() * art_scale));
|
||||||
|
}
|
||||||
|
|
||||||
|
moon = load("moon.png");
|
||||||
|
moon_sprite = Sprite(moon);
|
||||||
|
moon_sprite.SetPosition(Math.Int(center_x - moon.GetWidth() / 2), Math.Int(center_y - moon.GetHeight() / 2), 1);
|
||||||
|
|
||||||
|
track = load("track.png");
|
||||||
|
fill = load("fill.png");
|
||||||
|
bar_x = Math.Int(center_x - track.GetWidth() / 2);
|
||||||
|
bar_y = Math.Int(center_y + moon.GetHeight() / 2 + 120 * art_scale);
|
||||||
|
|
||||||
|
mode = Plymouth.GetMode();
|
||||||
|
has_bar = mode == "boot";
|
||||||
|
|
||||||
|
if (has_bar) {
|
||||||
|
track_sprite = Sprite(track);
|
||||||
|
track_sprite.SetPosition(bar_x, bar_y, 1);
|
||||||
|
fill_sprite = Sprite();
|
||||||
|
fill_sprite.SetPosition(bar_x, bar_y, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
target = 0;
|
||||||
|
shown = 0;
|
||||||
|
drawn = 0;
|
||||||
|
|
||||||
|
fun draw_bar() {
|
||||||
|
if (!has_bar) return;
|
||||||
|
local.width = Math.Int(fill.GetWidth() * shown);
|
||||||
|
# Redraw only when the bar grows by a pixel; narrower than its rounded cap it isn't drawn.
|
||||||
|
if (width <= drawn || width < fill.GetHeight()) return;
|
||||||
|
global.drawn = width;
|
||||||
|
fill_sprite.SetImage(fill.Crop(0, 0, width, fill.GetHeight()));
|
||||||
|
}
|
||||||
|
|
||||||
|
fun progress_callback(duration, progress) {
|
||||||
|
if (progress > 1) progress = 1;
|
||||||
|
if (progress > target) global.target = progress;
|
||||||
|
}
|
||||||
|
Plymouth.SetBootProgressFunction(progress_callback);
|
||||||
|
|
||||||
|
phase = 0;
|
||||||
|
ticks = 0;
|
||||||
|
fun refresh_callback() {
|
||||||
|
if (shown < target) {
|
||||||
|
global.shown = shown + (target - shown) * 0.08;
|
||||||
|
draw_bar();
|
||||||
|
}
|
||||||
|
# A slow breath, 12 times a second: the panel is drawn by the CPU.
|
||||||
|
global.ticks = ticks + 1;
|
||||||
|
if (ticks >= 4) {
|
||||||
|
global.ticks = 0;
|
||||||
|
global.phase = phase + 0.10;
|
||||||
|
moon_sprite.SetOpacity(0.86 + 0.14 * Math.Cos(phase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Plymouth.SetRefreshFunction(refresh_callback);
|
||||||
|
|
||||||
|
# The session is about to take the screen: finish the bar.
|
||||||
|
fun quit_callback() {
|
||||||
|
global.target = 1;
|
||||||
|
global.shown = 1;
|
||||||
|
draw_bar();
|
||||||
|
moon_sprite.SetOpacity(1);
|
||||||
|
}
|
||||||
|
Plymouth.SetQuitFunction(quit_callback);
|
||||||
|
|
||||||
|
# fsck, emergency mode and the like.
|
||||||
|
message_sprite = Sprite();
|
||||||
|
fun message_callback(text) {
|
||||||
|
local.image = Image.Text(text, 0.78, 0.84, 1);
|
||||||
|
message_sprite.SetImage(image);
|
||||||
|
message_sprite.SetPosition(Math.Int(center_x - image.GetWidth() / 2), bar_y + Math.Int(60 * art_scale), 3);
|
||||||
|
}
|
||||||
|
Plymouth.SetMessageFunction(message_callback);
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 515 B |
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="540" height="12">
|
||||||
|
<defs><linearGradient id="g"><stop offset="0" stop-color="#7c9cff"/><stop offset="1" stop-color="#eef4ff"/></linearGradient></defs>
|
||||||
|
<rect width="540" height="12" rx="6" fill="url(#g)"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 262 B |
@@ -0,0 +1,17 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="480" height="480">
|
||||||
|
<!-- The favicon's moon without its tile; boot/plymouth/render.sh turns it into chandra/moon.png. -->
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="moon" x1="0.15" y1="0.1" x2="0.85" y2="0.9">
|
||||||
|
<stop offset="0%" stop-color="#eef4ff"/>
|
||||||
|
<stop offset="48%" stop-color="#a5bdff"/>
|
||||||
|
<stop offset="100%" stop-color="#7c9cff"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="glow">
|
||||||
|
<stop offset="45%" stop-color="#7c9cff" stop-opacity="0.22"/>
|
||||||
|
<stop offset="100%" stop-color="#7c9cff" stop-opacity="0"/>
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
<circle cx="32" cy="32" r="32" fill="url(#glow)"/>
|
||||||
|
<path transform="translate(-1 0)" fill="url(#moon)"
|
||||||
|
d="M 30.66 13.15 A 19 19 0 1 0 50.44 39.53 A 16.5 16.5 0 0 1 30.66 13.15 Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 827 B |
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Render the theme's PNGs from the SVGs beside this script (needs rsvg-convert).
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
for f in moon track fill; do rsvg-convert "$f.svg" -o "chandra/$f.png"; done
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="540" height="12"><rect width="540" height="12" rx="6" fill="#7c9cff" fill-opacity="0.18"/></svg>
|
||||||
|
After Width: | Height: | Size: 144 B |
Reference in new issue
Block a user