mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
Merge pull request #104 from ryanrhughes/add-boot-screen
Add graphical boot screen
This commit is contained in:
BIN
default/plymouth/bullet.png
Normal file
BIN
default/plymouth/bullet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 358 B |
BIN
default/plymouth/entry.png
Normal file
BIN
default/plymouth/entry.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 694 B |
BIN
default/plymouth/lock.png
Normal file
BIN
default/plymouth/lock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 531 B |
BIN
default/plymouth/logo.png
Normal file
BIN
default/plymouth/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
11
default/plymouth/omarchy.plymouth
Normal file
11
default/plymouth/omarchy.plymouth
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Plymouth Theme]
|
||||||
|
Name=Omarchy
|
||||||
|
Description=Omarchy splash screen.
|
||||||
|
ModuleName=script
|
||||||
|
|
||||||
|
[script]
|
||||||
|
ImageDir=/usr/share/plymouth/themes/omarchy
|
||||||
|
ScriptFile=/usr/share/plymouth/themes/omarchy/omarchy.script
|
||||||
|
ConsoleLogBackgroundColor=0x1a1b26
|
||||||
|
|
||||||
|
|
236
default/plymouth/omarchy.script
Normal file
236
default/plymouth/omarchy.script
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
# Omarchy Plymouth Theme Script
|
||||||
|
|
||||||
|
Window.SetBackgroundTopColor(0.101, 0.105, 0.149);
|
||||||
|
Window.SetBackgroundBottomColor(0.101, 0.105, 0.149);
|
||||||
|
|
||||||
|
logo.image = Image("logo.png");
|
||||||
|
logo.sprite = Sprite(logo.image);
|
||||||
|
logo.sprite.SetX (Window.GetX() + Window.GetWidth() / 2 - logo.image.GetWidth() / 2);
|
||||||
|
logo.sprite.SetY (Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2);
|
||||||
|
logo.sprite.SetOpacity (1);
|
||||||
|
|
||||||
|
# Use these to adjust the progress bar timing
|
||||||
|
global.fake_progress_limit = 0.8; # Target percentage for fake progress (0.0 to 1.0)
|
||||||
|
global.fake_progress_duration = 15.0; # Duration in seconds to reach limit
|
||||||
|
|
||||||
|
# Progress bar animation variables
|
||||||
|
global.fake_progress = 0.0;
|
||||||
|
global.real_progress = 0.0;
|
||||||
|
global.fake_progress_active = 0; # 0 / 1 boolean
|
||||||
|
global.animation_frame = 0;
|
||||||
|
global.fake_progress_start_time = 0; # Track when fake progress started
|
||||||
|
global.password_shown = 0; # Track if password dialog has been shown
|
||||||
|
|
||||||
|
fun refresh_callback ()
|
||||||
|
{
|
||||||
|
global.animation_frame++;
|
||||||
|
|
||||||
|
# Animate fake progress to limit over time with easing
|
||||||
|
if (global.fake_progress_active == 1)
|
||||||
|
{
|
||||||
|
# Calculate elapsed time since start
|
||||||
|
elapsed_time = global.animation_frame / 50.0; # Convert frames to seconds (50 FPS)
|
||||||
|
|
||||||
|
# Calculate linear progress ratio (0 to 1) based on time
|
||||||
|
time_ratio = elapsed_time / global.fake_progress_duration;
|
||||||
|
if (time_ratio > 1.0)
|
||||||
|
time_ratio = 1.0;
|
||||||
|
|
||||||
|
# Apply easing curve: ease-out quadratic
|
||||||
|
# Formula: 1 - (1 - x)^2
|
||||||
|
eased_ratio = 1 - ((1 - time_ratio) * (1 - time_ratio));
|
||||||
|
|
||||||
|
# Calculate fake progress based on eased ratio
|
||||||
|
global.fake_progress = eased_ratio * global.fake_progress_limit;
|
||||||
|
|
||||||
|
# Update progress bar with fake progress
|
||||||
|
update_progress_bar(global.fake_progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Plymouth.SetRefreshFunction (refresh_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Helper Functions --------------------------------
|
||||||
|
|
||||||
|
fun update_progress_bar(progress)
|
||||||
|
{
|
||||||
|
width = Math.Int(progress_bar.original_image.GetWidth() * progress);
|
||||||
|
if (width < 1) width = 1; # Ensure minimum width of 1 pixel
|
||||||
|
|
||||||
|
progress_bar.image = progress_bar.original_image.Scale(width, progress_bar.original_image.GetHeight());
|
||||||
|
progress_bar.sprite.SetImage(progress_bar.image);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show_progress_bar()
|
||||||
|
{
|
||||||
|
progress_box.sprite.SetOpacity(1);
|
||||||
|
progress_bar.sprite.SetOpacity(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide_progress_bar()
|
||||||
|
{
|
||||||
|
progress_box.sprite.SetOpacity(0);
|
||||||
|
progress_bar.sprite.SetOpacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show_password_dialog()
|
||||||
|
{
|
||||||
|
lock.sprite.SetOpacity(1);
|
||||||
|
entry.sprite.SetOpacity(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide_password_dialog()
|
||||||
|
{
|
||||||
|
lock.sprite.SetOpacity(0);
|
||||||
|
entry.sprite.SetOpacity(0);
|
||||||
|
for (index = 0; bullet.sprites[index]; index++)
|
||||||
|
bullet.sprites[index].SetOpacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun start_fake_progress()
|
||||||
|
{
|
||||||
|
global.fake_progress = 0.0;
|
||||||
|
global.real_progress = 0.0;
|
||||||
|
global.fake_progress_active = 1;
|
||||||
|
global.animation_frame = 0;
|
||||||
|
update_progress_bar(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun stop_fake_progress()
|
||||||
|
{
|
||||||
|
global.fake_progress_active = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#----------------------------------------- Dialogue --------------------------------
|
||||||
|
|
||||||
|
# Dialog elements - create once, reuse
|
||||||
|
lock.image = Image("lock.png");
|
||||||
|
entry.image = Image("entry.png");
|
||||||
|
bullet.image = Image("bullet.png");
|
||||||
|
|
||||||
|
entry.sprite = Sprite(entry.image);
|
||||||
|
entry.x = Window.GetX() + Window.GetWidth()/2 - entry.image.GetWidth() / 2;
|
||||||
|
entry.y = logo.sprite.GetY() + logo.image.GetHeight() + 40;
|
||||||
|
entry.sprite.SetPosition(entry.x, entry.y, 10001);
|
||||||
|
entry.sprite.SetOpacity(0);
|
||||||
|
|
||||||
|
lock.sprite = Sprite(lock.image);
|
||||||
|
lock.x = entry.x - lock.image.GetWidth() - 10;
|
||||||
|
lock.y = entry.y + entry.image.GetHeight()/2 - lock.image.GetHeight()/2;
|
||||||
|
lock.sprite.SetPosition(lock.x, lock.y, 10001);
|
||||||
|
lock.sprite.SetOpacity(0);
|
||||||
|
|
||||||
|
# Bullet array
|
||||||
|
bullet.sprites = [];
|
||||||
|
|
||||||
|
fun display_normal_callback ()
|
||||||
|
{
|
||||||
|
hide_password_dialog();
|
||||||
|
|
||||||
|
# Get current mode
|
||||||
|
mode = Plymouth.GetMode();
|
||||||
|
|
||||||
|
# Only require password_shown check for boot and resume modes
|
||||||
|
show_progress = 0;
|
||||||
|
if ((mode == "boot" || mode == "resume") && global.password_shown == 1)
|
||||||
|
show_progress = 1;
|
||||||
|
else if (mode != "boot" && mode != "resume")
|
||||||
|
show_progress = 1;
|
||||||
|
|
||||||
|
if (show_progress == 1)
|
||||||
|
{
|
||||||
|
show_progress_bar();
|
||||||
|
start_fake_progress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun display_password_callback (prompt, bullets)
|
||||||
|
{
|
||||||
|
global.password_shown = 1; # Mark that password dialog has been shown
|
||||||
|
|
||||||
|
stop_fake_progress();
|
||||||
|
hide_progress_bar();
|
||||||
|
show_password_dialog();
|
||||||
|
|
||||||
|
# Clear all bullets first
|
||||||
|
for (index = 0; bullet.sprites[index]; index++)
|
||||||
|
bullet.sprites[index].SetOpacity(0);
|
||||||
|
|
||||||
|
# Create and show bullets for current password
|
||||||
|
for (index = 0; index < bullets; index++)
|
||||||
|
{
|
||||||
|
if (!bullet.sprites[index])
|
||||||
|
{
|
||||||
|
bullet.sprites[index] = Sprite(bullet.image);
|
||||||
|
bullet.x = entry.x + 20 + index * (bullet.image.GetWidth() + 5);
|
||||||
|
bullet.y = entry.y + entry.image.GetHeight() / 2 - bullet.image.GetHeight() / 2;
|
||||||
|
bullet.sprites[index].SetPosition(bullet.x, bullet.y, 10002);
|
||||||
|
}
|
||||||
|
bullet.sprites[index].SetOpacity(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetDisplayNormalFunction(display_normal_callback);
|
||||||
|
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Progress Bar --------------------------------
|
||||||
|
|
||||||
|
progress_box.image = Image("progress_box.png");
|
||||||
|
progress_box.sprite = Sprite(progress_box.image);
|
||||||
|
|
||||||
|
progress_box.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2;
|
||||||
|
progress_box.y = entry.y + entry.image.GetHeight() / 2 - progress_box.image.GetHeight() / 2;
|
||||||
|
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
|
||||||
|
progress_box.sprite.SetOpacity(0);
|
||||||
|
|
||||||
|
progress_bar.original_image = Image("progress_bar.png");
|
||||||
|
progress_bar.sprite = Sprite();
|
||||||
|
progress_bar.image = progress_bar.original_image.Scale(1, progress_bar.original_image.GetHeight());
|
||||||
|
|
||||||
|
progress_bar.x = Window.GetX() + Window.GetWidth() / 2 - progress_bar.original_image.GetWidth() / 2;
|
||||||
|
progress_bar.y = progress_box.y + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
|
||||||
|
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
|
||||||
|
progress_bar.sprite.SetOpacity(0);
|
||||||
|
|
||||||
|
fun progress_callback (duration, progress)
|
||||||
|
{
|
||||||
|
global.real_progress = progress;
|
||||||
|
|
||||||
|
# If real progress is above limit, stop fake progress and use real progress
|
||||||
|
if (progress > global.fake_progress_limit)
|
||||||
|
{
|
||||||
|
stop_fake_progress();
|
||||||
|
update_progress_bar(progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetBootProgressFunction(progress_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Quit --------------------------------
|
||||||
|
|
||||||
|
fun quit_callback ()
|
||||||
|
{
|
||||||
|
logo.sprite.SetOpacity (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetQuitFunction(quit_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Message --------------------------------
|
||||||
|
|
||||||
|
message_sprite = Sprite();
|
||||||
|
message_sprite.SetPosition(10, 10, 10000);
|
||||||
|
|
||||||
|
fun display_message_callback (text)
|
||||||
|
{
|
||||||
|
my_image = Image.Text(text, 1, 1, 1);
|
||||||
|
message_sprite.SetImage(my_image);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide_message_callback (text)
|
||||||
|
{
|
||||||
|
message_sprite.SetOpacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetDisplayMessageFunction (display_message_callback);
|
||||||
|
Plymouth.SetHideMessageFunction (hide_message_callback);
|
BIN
default/plymouth/progress_bar.png
Normal file
BIN
default/plymouth/progress_bar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 314 B |
BIN
default/plymouth/progress_box.png
Normal file
BIN
default/plymouth/progress_box.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 314 B |
88
install/plymouth.sh
Executable file
88
install/plymouth.sh
Executable file
@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Install Plymouth package
|
||||||
|
echo "Installing Plymouth..."
|
||||||
|
yay -S --noconfirm --needed plymouth
|
||||||
|
|
||||||
|
# Skip if plymouth already exists for some reason
|
||||||
|
if ! grep -q "^HOOKS=.*plymouth" /etc/mkinitcpio.conf; then
|
||||||
|
# Backup original mkinitcpio.conf just in case
|
||||||
|
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||||
|
sudo cp /etc/mkinitcpio.conf "/etc/mkinitcpio.conf.bak.${backup_timestamp}"
|
||||||
|
|
||||||
|
# Add plymouth to HOOKS array after 'base udev' or 'base systemd'
|
||||||
|
if grep "^HOOKS=" /etc/mkinitcpio.conf | grep -q "base systemd"; then
|
||||||
|
sudo sed -i '/^HOOKS=/s/base systemd/base systemd plymouth/' /etc/mkinitcpio.conf
|
||||||
|
elif grep "^HOOKS=" /etc/mkinitcpio.conf | grep -q "base udev"; then
|
||||||
|
sudo sed -i '/^HOOKS=/s/base udev/base udev plymouth/' /etc/mkinitcpio.conf
|
||||||
|
else
|
||||||
|
echo "Couldn't add the Plymouth hook"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Plymouth already present in mkinitcpio.conf HOOKS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Regenerate initramfs
|
||||||
|
sudo mkinitcpio -P
|
||||||
|
|
||||||
|
# Add kernel parameters for Plymouth (systemd-boot only)
|
||||||
|
if [ -d "/boot/loader/entries" ]; then
|
||||||
|
echo "Detected systemd-boot"
|
||||||
|
|
||||||
|
for entry in /boot/loader/entries/*.conf; do
|
||||||
|
if [ -f "$entry" ]; then
|
||||||
|
# Skip fallback entries
|
||||||
|
if [[ "$(basename "$entry")" == *"fallback"* ]]; then
|
||||||
|
echo "Skipped: $(basename "$entry") (fallback entry)"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Skip if splash it already present for some reason
|
||||||
|
if ! grep -q "splash" "$entry"; then
|
||||||
|
sudo sed -i '/^options/ s/$/ splash quiet/' "$entry"
|
||||||
|
else
|
||||||
|
echo "Skipped: $(basename "$entry") (splash already present)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
elif [ -f "/etc/default/grub" ]; then
|
||||||
|
# Backup GRUB config before modifying
|
||||||
|
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||||
|
sudo cp /etc/default/grub "/etc/default/grub.bak.${backup_timestamp}"
|
||||||
|
|
||||||
|
# Check if splash is already in GRUB_CMDLINE_LINUX_DEFAULT
|
||||||
|
if ! grep -q "GRUB_CMDLINE_LINUX_DEFAULT.*splash" /etc/default/grub; then
|
||||||
|
# Get current GRUB_CMDLINE_LINUX_DEFAULT value
|
||||||
|
current_cmdline=$(grep "^GRUB_CMDLINE_LINUX_DEFAULT=" /etc/default/grub | cut -d'"' -f2)
|
||||||
|
|
||||||
|
# Add splash and quiet if not present
|
||||||
|
new_cmdline="$current_cmdline"
|
||||||
|
if [[ ! "$current_cmdline" =~ splash ]]; then
|
||||||
|
new_cmdline="$new_cmdline splash"
|
||||||
|
fi
|
||||||
|
if [[ ! "$current_cmdline" =~ quiet ]]; then
|
||||||
|
new_cmdline="$new_cmdline quiet"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Trim any leading/trailing spaces
|
||||||
|
new_cmdline=$(echo "$new_cmdline" | xargs)
|
||||||
|
|
||||||
|
sudo sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=\".*\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$new_cmdline\"/" /etc/default/grub
|
||||||
|
|
||||||
|
# Regenerate grub config
|
||||||
|
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
else
|
||||||
|
echo "GRUB already configured with splash kernel parameters"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Neither systemd-boot nor GRUB detected. Please manually add these kernel parameters:"
|
||||||
|
echo " - splash (to see the graphical splash screen)"
|
||||||
|
echo " - quiet (for silent boot)"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy and set the Plymouth theme
|
||||||
|
sudo cp -r "$HOME/.local/share/omarchy/default/plymouth" /usr/share/plymouth/themes/omarchy/
|
||||||
|
|
||||||
|
sudo plymouth-set-default-theme -R omarchy
|
6
migrations/1751743990.sh
Normal file
6
migrations/1751743990.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Run Plymouth installation script
|
||||||
|
echo "Install Plymouth splash screen"
|
||||||
|
bash "$HOME/.local/share/omarchy/install/plymouth.sh"
|
||||||
|
|
Reference in New Issue
Block a user