// =============================================================================
// KAMOS Gaming OS - Plymouth boot splash
// Pure black background (matches the wallpaper aesthetic) with the KAMOS logo
// centered, plus a subtle pulsing alpha so it feels alive on long boots.
// =============================================================================

// 1. Pure black background
Window.SetBackgroundTopColor(0.0, 0.0, 0.0);
Window.SetBackgroundBottomColor(0.0, 0.0, 0.0);

// 2. Logo - expects kamos-logo.png in the same theme directory
logo.image  = Image("kamos-logo.png");
logo.sprite = Sprite(logo.image);
logo.x = Window.GetX() + Window.GetWidth()  / 2 - logo.image.GetWidth()  / 2;
logo.y = Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2;
logo.sprite.SetPosition(logo.x, logo.y, 0);

// 3. Gentle pulse - alpha bobs between 0.65 and 1.0 over ~2 seconds
progress = 0;
fun refresh_callback () {
    progress += 0.02;
    alpha = 0.825 + 0.175 * Math.Sin(progress);
    logo.sprite.SetOpacity(alpha);
}
Plymouth.SetRefreshFunction(refresh_callback);

// 4. Show password prompts (LUKS unlock) below the logo if needed
fun display_password_callback (prompt, bullets) {
    if (!global.prompt_box) {
        global.prompt_box.image = Image.Text(prompt, 1, 1, 1);
        global.prompt_box.sprite = Sprite(global.prompt_box.image);
        global.prompt_box.sprite.SetPosition(
            Window.GetWidth() / 2 - global.prompt_box.image.GetWidth() / 2,
            logo.y + logo.image.GetHeight() + 40,
            1);
    }
}
Plymouth.SetDisplayPasswordFunction(display_password_callback);
