Help...... Plymouth Script needed

Style your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
hexdef101

Help...... Plymouth Script needed

Post by hexdef101 »

This is the Plymouth theme I am trying to design. I need a bit of help though. I cannot find a good enough plymouth script to modify as either none have a background image or none have a progress bar. If someone who actually knows Plymouth scripts can write a simple one I have already provided the rest of the resources.

Here are the specifics

Startup:
Background image
window image (overlayed), alternate method, but not preferred (pasted onto background)
Progress box (overlayed)
Progress bar (overlayed)


Shutdown:

Background image
Logo image (centered) I haven't provided this image as I haven't decided if i want to use my mint logo or just a Goodbye message. Either way it will be an image in .Png so take that into account.

oh and Make the progress bar fairly quick... every one I have seen with one never finishes out. It only makes it about halfway before mdm starts.

Also text above progress bar maybe.... something to the effect of "Initializing" or whatever.

This is an open source project, You will be given Credit (Byline) for providing the script.

I am aware that many aren't into my Mac style Designs, But the end result would be easily modifiable by changing the resource files to whatever someone else wants.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
hexdef101

Re: Help...... Plymouth Script needed

Post by hexdef101 »

Image

Resource Download link on Deviantart

Updated Resources :D
hexdef101

Re: Help...... Plymouth Script needed

Post by hexdef101 »

Ok I tried to write the script myself. I failed miserably. I cannot get the stupid thing to work at all. :evil: I amposting the code here and placing the Newest version of the theme resources including .script and .plymouth files on deviantart at the same link as before.

Please look this over and help as I have no idea what I am doing wrong.

Code: Select all

/* Mint OS Splash Screen */

if ( Plymouth.GetMode () == "boot" )
  {

progress = 0
background_image = Image("Background.png");
window_image = Image("Window.png");
logo_image = Image("Logo.png");
progbox_image = Image("Progress-Box")


screen_width = Window.GetWidth();
screen_height = Window.GetHeight();
}

if (screen_ratio > background_image_ratio)
  {  scale_factor =  Window.GetHeight() / background_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / background_image.GetWidth();
  }
scaled_background_image = background_image.Scale(background_image.GetWidth()  * scale_factor,
                                         background_image.GetHeight() * scale_factor);
background_sprite = Sprite(scaled_background_image);
background_sprite.SetX(Window.GetWidth()  / 2 - scaled_background_image.GetWidth()  / 2); # Place in the centre 
background_sprite.SetY(Window.GetHeight() / 2 - scaled_background_image.GetHeight() / 2);
background_sprite.SetZ(-10000);
}

if (screen_ratio > window_image_ratio)
  {  scale_factor =  Window.GetHeight() / window_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / window_image.GetWidth();
  }
scaled_window_image = window_image.Scale(window_image.GetWidth()  * scale_factor,
                                         window_image.GetHeight() * scale_factor);
window_sprite = Sprite(scaled_window_image);
window_sprite.SetX(Window.GetWidth()  / 2 - scaled_window_image.GetWidth()  / 2); # Place in the centre 
window_sprite.SetY(Window.GetHeight() / 2 - scaled_window_image.GetHeight() / 2);
window_sprite.SetZ(-10000);
}

if (screen_ratio > logo_image_ratio)
  {  scale_factor =  Window.GetHeight() / logo_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / logo_image.GetWidth();
  }
scaled_logo_image = logo_image.Scale(logo_image.GetWidth()  * scale_factor,
                                         logo_image.GetHeight() * scale_factor);
logo_sprite = Sprite(scaled_logo_image);
logo_sprite.SetX(Window.GetWidth()  / 2 - scaled_logo_image.GetWidth()  / 2); # Place in the centre 
logo_sprite.SetY(Window.GetHeight() / 2 - scaled_logo_image.GetHeight() / 2);
logo_sprite.SetZ(-10000);
}

if (screen_ratio > progbox_image_ratio)
  {  scale_factor =  Window.GetHeight() / progbox_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / progbox_image.GetWidth();
  }
scaled_progbox_image = progbox_image.Scale(progbox_image.GetWidth()  * scale_factor,
                                         progbox_image.GetHeight() * scale_factor);
progbox_sprite = Sprite(scaled_progbox_image);
progbox_sprite.SetX(Window.GetWidth()  / 2 - scaled_progbox_image.GetWidth()  / 2); # Place in the centre 
progbox_sprite.SetY(Window.GetHeight() / 2 - scaled_progbox_image.GetHeight() / 2);
progbox_sprite.SetZ(-10000);
}
else
  {
    background_image = Image("Background.png");
    goodbye.image = Image("Goodbye.png");

screen_width = Window.GetWidth();
screen_height = Window.GetHeight();

if (screen_ratio > background_image_ratio)
  {  scale_factor =  Window.GetHeight() / background_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / background_image.GetWidth();
  }
scaled_background_image = background_image.Scale(background_image.GetWidth()  * scale_factor,
                                         background_image.GetHeight() * scale_factor);
background_sprite = Sprite(scaled_background_image);
background_sprite.SetX(Window.GetWidth()  / 2 - scaled_background_image.GetWidth()  / 2); # Place in the centre 
background_sprite.SetY(Window.GetHeight() / 2 - scaled_background_image.GetHeight() / 2);
background_sprite.SetZ(-10000);
}


if (screen_ratio > goodbye_image_ratio)
  {  scale_factor =  Window.GetHeight() / goodbye_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / goodbye_image.GetWidth();
  }
scaled_goodbye_image = goodbye_image.Scale(goodbye_image.GetWidth()  * scale_factor,
                                         goodbye_image.GetHeight() * scale_factor);
goodbye_sprite = Sprite(scaled_goodbye_image);
goodbye_sprite.SetX(Window.GetWidth()  / 2 - scaled_goodbye_image.GetWidth()  / 2); # Place in the centre 
goodbye_sprite.SetY(Window.GetHeight() / 2 - scaled_goodbye_image.GetHeight() / 2);
goodbye_sprite.SetZ(-10000);

    
  }
#----------------------------------------- Progress Bar --------------------------------


bar_image = Image("Bar-1")

if (screen_ratio > bar_image_ratio)
  {  scale_factor =  Window.GetHeight() / bar_image.GetHeight();
  }
else
  {  scale_factor =  Window.GetWidth() / bar_image.GetWidth();
  }
scaled_bar_image = bar_image.Scale(bar_image.GetWidth()  * scale_factor,
                                         bar_image.GetHeight() * scale_factor);
bar_sprite = Sprite(scaled_bar_image);
bar_sprite.SetX(Window.GetWidth()  / 2 - scaled_bar_image.GetWidth()  / 2); # Place in the centre 
bar_sprite.SetY(Window.GetHeight() / 2 - scaled_bar_image.GetHeight() / 2);
bar_sprite.SetZ(-10000);


progress = 0;
fun refresh_callback ()
  {
    progress++;
    bar_sprite.SetX(progress);
  }
for (i = 1; i < 11; i++)
  bar_images[i] = Image("bar" + i + ".png");
bar_sprite = Sprite();
bar_sprite.SetImage(bar_images[Math.Int(progress / 120) % 11]);
Plymouth.SetRefreshFunction (refresh_callback);

#----------------------------------------- Quit --------------------------------

fun quit_callback ()
{
}

Plymouth.SetQuitFunction(quit_callback);

#----------------------------------------- Message --------------------------------

message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);

fun message_callback (text)
{
  my_image = Image.Text(text, 1, 1, 1);
  message_sprite.SetImage(my_image);
}

Plymouth.SetMessageFunction(message_callback);
DrHu

Re: Help...... Plymouth Script needed

Post by DrHu »

Not sure what you are doing with the sprite setup you use: I think the background image part (PNG) will be available with the Ubuntu user posted method below..

--I see this, it looks simpler.
http://askubuntu.com/questions/143330/h ... ot-up-logo

Code: Select all

Sprite
Use Sprite to place Image on screen.
How to create Sprite ?
first_sprite = Sprite ();
first_sprite.SetImage (background);

  Or by supplying image to its constructor,
first_sprite = Sprite (background);
 How to Set different Positions on screen (x,y,z) ?
first_sprite.SetX (300); # put at x=300
first_sprite.SetY (200); # put at y=200
background.SetZ(-20);
foreground.SetZ(50);

  Or you can define with SetPosition()
first_sprite.Setposition(300, 200, 50) # put at x=300, y=200, z=50

 How to change Opacity ?
faded_sprite.SetOpacity (0.3);
invisible_sprite.SetOpacity (0); 
hexdef101

Re: Help...... Plymouth Script needed

Post by hexdef101 »

thanks for replying...... first off I was trying to clean up the code a bit (badly). I can of course rewrite the code to do it that way... I just thought that this was more efficiant. Like a nice clean HD. I didn't realize it had to be one for one.
hexdef101

Re: Help...... Plymouth Script needed

Post by hexdef101 »

I rewrote the first half of the code like thus...

Code: Select all

/* Mint OS Splash Screen */

if ( Plymouth.GetMode () == "boot" )
  {

    Window.SetBackgroundTopColor (0.75, 0.75, 0.75);
    Window.SetBackgroundBottomColor (0.75, 0.75, 0.75);

    progress = 0;

    screen_width = Window.GetWidth();
    screen_height = Window.GetHeight();

    background_image = Image("Background.png");
    if (screen_ratio > background_image_ratio)
    {  scale_factor =  Window.GetHeight() / background_image.GetHeight();
 }
    else
    {  scale_factor =  Window.GetWidth() / background_image.GetWidth();
  }


    scaled_background_image = background_image.Scale(background_image.GetWidth()  * scale_factor,
                                         background_image.GetHeight() * scale_factor);
    background_sprite = Sprite(scaled_background_image);


    background_sprite.SetX(Window.GetWidth()  / 2 - scaled_background_image.GetWidth()  / 2); # Place in the centre 
    background_sprite.SetY(Window.GetHeight() / 2 - scaled_background_image.GetHeight() / 2);
    background_sprite.SetZ(-10000);

    window_image = Image("Window.png");
    if (screen_ratio > window_image_ratio)
  {  scale_factor =  Window.GetHeight() / window_image.GetHeight();
  }
    else
  {  scale_factor =  Window.GetWidth() / window_image.GetWidth();
  }

   scaled_window_image = window_image.Scale(window_image.GetWidth()  * scale_factor,
                                         window_image.GetHeight() * scale_factor);
   window_sprite = Sprite(scaled_window_image);


   window_sprite.SetX(Window.GetWidth()  / 2 - scaled_window_image.GetWidth()  / 2); # Place in the centre 
   window_sprite.SetY(Window.GetHeight() / 2 - scaled_window_image.GetHeight() / 2);
   window_sprite.SetZ(-10000);

   logo_image = Image("Logo.png");
   if (screen_ratio > logo_image_ratio)
  {  scale_factor =  Window.GetHeight() / logo_image.GetHeight();
  }
   else
  {  scale_factor =  Window.GetWidth() / logo_image.GetWidth();
  }

   scaled_logo_image = logo_image.Scale(logo_image.GetWidth()  * scale_factor,
                                         logo_image.GetHeight() * scale_factor);
   logo_sprite = Sprite(scaled_logo_image);

   logo_sprite.SetX(Window.GetWidth()  / 2 - scaled_logo_image.GetWidth()  / 2); # Place in the centre 
   logo_sprite.SetY(Window.GetHeight() / 2 - scaled_logo_image.GetHeight() / 2);
   logo_sprite.SetZ(-10000);

   progbox_image = Image("Progress-Box")
   if (screen_ratio > progbox_image_ratio)
  {  scale_factor =  Window.GetHeight() / progbox_image.GetHeight();
  }
   else
  {  scale_factor =  Window.GetWidth() / progbox_image.GetWidth();
  }
   scaled_progbox_image = progbox_image.Scale(progbox_image.GetWidth()  * scale_factor,
                                         progbox_image.GetHeight() * scale_factor);
   progbox_sprite = Sprite(scaled_progbox_image);

   progbox_sprite.SetX(Window.GetWidth()  / 2 - scaled_progbox_image.GetWidth()  / 2); # Place in the centre 
   progbox_sprite.SetY(Window.GetHeight() / 2 - scaled_progbox_image.GetHeight() / 2);
   progbox_sprite.SetZ(-10000);

   bar_image = Image("Bar-1")
   if (screen_ratio > bar_image_ratio)
  {  scale_factor =  Window.GetHeight() / bar_image.GetHeight();
  }
   else
  {  scale_factor =  Window.GetWidth() / bar_image.GetWidth();
  }
   scaled_bar_image = bar_image.Scale(bar_image.GetWidth()  * scale_factor,
                                         bar_image.GetHeight() * scale_factor);
   bar_sprite = Sprite(scaled_bar_image);

   bar_sprite.SetX(Window.GetWidth()  / 2 - scaled_bar_image.GetWidth()  / 2); # Place in the centre 
   bar_sprite.SetY(Window.GetHeight() / 2 - scaled_bar_image.GetHeight() / 2);
   bar_sprite.SetZ(-10000);



fun refresh_callback ()
  {
    progress++;
    bar_sprite.SetX(progress);
  }
for (i = 1; i < 11; i++)
  bar_images[i] = Image("bar-" + i + ".png");
  bar_sprite = Sprite();
  bar_sprite.SetImage(bar_images[Math.Int(progress / 120) % 11]);
  Plymouth.SetRefreshFunction (refresh_callback);
This is just the [Boot] section not the Shutdown section. (oh and if you are wondering why I am resizing all of the images to fit the screen... I want it to work on any screen, not just mine.
hexdef101

Re: Help...... Plymouth Script needed

Post by hexdef101 »

rewrote the whole thing. Still doesn't work.

Code: Select all

/* Mint OS Splash Screen */

if ( Plymouth.GetMode () == "boot" )
  {

    Window.SetBackgroundTopColor (0.75, 0.75, 0.75);
    Window.SetBackgroundBottomColor (0.75, 0.75, 0.75);

    progress = 0;

    screen_width = Window.GetWidth();
    screen_height = Window.GetHeight();

    background_image = Image("Background.png");
    if (screen_ratio > background_image_ratio)
    {  scale_factor =  Window.GetHeight() / background_image.GetHeight();
 }
    else
    {  scale_factor =  Window.GetWidth() / background_image.GetWidth();
  }


    scaled_background_image = background_image.Scale(background_image.GetWidth()  * scale_factor,
                                         background_image.GetHeight() * scale_factor);
    background_sprite = Sprite(scaled_background_image);


    background_sprite.SetX(Window.GetWidth()  / 2 - scaled_background_image.GetWidth()  / 2); # Place in the centre 
    background_sprite.SetY(Window.GetHeight() / 2 - scaled_background_image.GetHeight() / 2);
    background_sprite.SetZ(-10000);

    window_image = Image("Window.png");
    if (screen_ratio > window_image_ratio)
  {  scale_factor =  Window.GetHeight() / window_image.GetHeight();
  }
    else
  {  scale_factor =  Window.GetWidth() / window_image.GetWidth();
  }

   scaled_window_image = window_image.Scale(window_image.GetWidth()  * scale_factor,
                                         window_image.GetHeight() * scale_factor);
   window_sprite = Sprite(scaled_window_image);


   window_sprite.SetX(Window.GetWidth()  / 2 - scaled_window_image.GetWidth()  / 2); # Place in the centre 
   window_sprite.SetY(Window.GetHeight() / 2 - scaled_window_image.GetHeight() / 2);
   window_sprite.SetZ(-10000);

   logo_image = Image("Logo.png");
   if (screen_ratio > logo_image_ratio)
  {  scale_factor =  Window.GetHeight() / logo_image.GetHeight();
  }
   else
  {  scale_factor =  Window.GetWidth() / logo_image.GetWidth();
  }

   scaled_logo_image = logo_image.Scale(logo_image.GetWidth()  * scale_factor,
                                         logo_image.GetHeight() * scale_factor);
   logo_sprite = Sprite(scaled_logo_image);

   logo_sprite.SetX(Window.GetWidth()  / 2 - scaled_logo_image.GetWidth()  / 2); # Place in the centre 
   logo_sprite.SetY(Window.GetHeight() / 2 - scaled_logo_image.GetHeight() / 2);
   logo_sprite.SetZ(-10000);

   progbox_image = Image("Progress-Box")
   if (screen_ratio > progbox_image_ratio)
  {  scale_factor =  Window.GetHeight() / progbox_image.GetHeight();
  }
   else
  {  scale_factor =  Window.GetWidth() / progbox_image.GetWidth();
  }
   scaled_progbox_image = progbox_image.Scale(progbox_image.GetWidth()  * scale_factor,
                                         progbox_image.GetHeight() * scale_factor);
   progbox_sprite = Sprite(scaled_progbox_image);

   progbox_sprite.SetX(Window.GetWidth()  / 2 - scaled_progbox_image.GetWidth()  / 2); # Place in the centre 
   progbox_sprite.SetY(Window.GetHeight() / 2 - scaled_progbox_image.GetHeight() / 2);
   progbox_sprite.SetZ(-10000);

   bar_image = Image("Bar-1")
   if (screen_ratio > bar_image_ratio)
  {  scale_factor =  Window.GetHeight() / bar_image.GetHeight();
  }
   else
  {  scale_factor =  Window.GetWidth() / bar_image.GetWidth();
  }
   scaled_bar_image = bar_image.Scale(bar_image.GetWidth()  * scale_factor,
                                         bar_image.GetHeight() * scale_factor);
   bar_sprite = Sprite(scaled_bar_image);

   bar_sprite.SetX(Window.GetWidth()  / 2 - scaled_bar_image.GetWidth()  / 2); # Place in the centre 
   bar_sprite.SetY(Window.GetHeight() / 2 - scaled_bar_image.GetHeight() / 2);
   bar_sprite.SetZ(-10000);



fun refresh_callback ()
  {
    progress++;
    bar_sprite.SetX(progress);
  }
for (i = 1; i < 11; i++)
  bar_images[i] = Image("bar-" + i + ".png");
  bar_sprite = Sprite();
  bar_sprite.SetImage(bar_images[Math.Int(progress / 120) % 11]);
  Plymouth.SetRefreshFunction (refresh_callback);

}
    

    else
  {
   
    Window.SetBackgroundTopColor (0.75, 0.75, 0.75);
    Window.SetBackgroundBottomColor (0.75, 0.75, 0.75);

    progress = 0;

    screen_width = Window.GetWidth();
    screen_height = Window.GetHeight();

    background_image = Image("Background.png");
    if (screen_ratio > background_image_ratio)
  {  scale_factor =  Window.GetHeight() / background_image.GetHeight();
  }
    else
  {  scale_factor =  Window.GetWidth() / background_image.GetWidth();
  }
    scaled_background_image = background_image.Scale(background_image.GetWidth()  * scale_factor,
                                         background_image.GetHeight() * scale_factor);
    background_sprite = Sprite(scaled_background_image);

    background_sprite.SetX(Window.GetWidth()  / 2 - scaled_background_image.GetWidth()  / 2); # Place in the centre 
    background_sprite.SetY(Window.GetHeight() / 2 - scaled_background_image.GetHeight() / 2);
    background_sprite.SetZ(-10000);

    goodbye.image = Image("Goodbye.png");
    if (screen_ratio > goodbye_image_ratio)
  {  scale_factor =  Window.GetHeight() / goodbye_image.GetHeight();
  }
    else
  {  scale_factor =  Window.GetWidth() / goodbye_image.GetWidth();
  }
    scaled_goodbye_image = goodbye_image.Scale(goodbye_image.GetWidth()  * scale_factor,
                                         goodbye_image.GetHeight() * scale_factor);
    goodbye_sprite = Sprite(scaled_goodbye_image);
    goodbye_sprite.SetX(Window.GetWidth()  / 2 - scaled_goodbye_image.GetWidth()  / 2); # Place in the centre 
    goodbye_sprite.SetY(Window.GetHeight() / 2 - scaled_goodbye_image.GetHeight() / 2);
    goodbye_sprite.SetZ(-10000);

    
  }

#----------------------------------------- Dialog --------------------------------

status = "normal";

fun dialog_setup()
  {
    local.box;
    local.lock;
    local.entry;
    
    box.image = Image("box.png");
    lock.image = Image("lock.png");
    entry.image = Image("entry.png");
    
    box.sprite = Sprite(box.image);
    box.x = Window.GetWidth()  / 2 - box.image.GetWidth ()/2;
    box.y = Window.GetHeight() / 2 - box.image.GetHeight()/2;
    box.z = 10000;
    box.sprite.SetPosition(box.x, box.y, box.z);
    
    lock.sprite = Sprite(lock.image);
    lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
    lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
    lock.z = box.z + 1;
    lock.sprite.SetPosition(lock.x, lock.y, lock.z);
    
    entry.sprite = Sprite(entry.image);
    entry.x = lock.x + lock.image.GetWidth();
    entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
    entry.z = box.z + 1;
    entry.sprite.SetPosition(entry.x, entry.y, entry.z);
    
    global.dialog.box = box;
    global.dialog.lock = lock;
    global.dialog.entry = entry;
    global.dialog.bullet_image = Image("bullet.png");
    dialog_opacity (1);
  }
    
fun dialog_opacity(opacity)
  {
    dialog.box.sprite.SetOpacity (opacity);
    dialog.lock.sprite.SetOpacity (opacity);
    dialog.entry.sprite.SetOpacity (opacity);
    for (index = 0; dialog.bullet[index]; index++)
      {
        dialog.bullet[index].sprite.SetOpacity(opacity);
      }
  }

fun display_normal_callback ()
  {
    global.status = "normal";
    if (global.dialog)
      dialog_opacity (0);
  }

fun display_password_callback (prompt, bullets)
  {
    global.status = "password";
    if (!global.dialog)
    dialog_setup();
    else
    dialog_opacity(1);
    for (index = 0; dialog.bullet[index] || index < bullets; index++)
      {
        if (!dialog.bullet[index])
          {
            dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
            dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
            dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
            dialog.bullet[index].z = dialog.entry.z + 1;
            dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
          }
        if (index < bullets)
          dialog.bullet[index].sprite.SetOpacity(1);
        else
          dialog.bullet[index].sprite.SetOpacity(0);
      }
  }

Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);


#----------------------------------------- Quit ----------------------------------

fun quit_callback ()
{
}

Plymouth.SetQuitFunction(quit_callback);

#----------------------------------------- Message --------------------------------

message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);

fun message_callback (text)
{
  my_image = Image.Text(text, 1, 1, 1);
  message_sprite.SetImage(my_image);
}

Plymouth.SetMessageFunction(message_callback);
    
:?:
Locked

Return to “Themes, Icons & Wallpaper”