commit f76249ee4c1a504194b387b39b00086e5f34c1b2 Author: Sohrab Behdani Date: Tue Jul 11 21:16:14 2023 +0330 initial push of plymouth theme diff --git a/README.md b/README.md new file mode 100644 index 0000000..66318e4 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Parch Linux plymouth theme diff --git a/usr/share/plymouth/themes/parch/boot.png b/usr/share/plymouth/themes/parch/boot.png new file mode 100644 index 0000000..6154db2 Binary files /dev/null and b/usr/share/plymouth/themes/parch/boot.png differ diff --git a/usr/share/plymouth/themes/parch/boot.svg b/usr/share/plymouth/themes/parch/boot.svg new file mode 100644 index 0000000..5ec4132 --- /dev/null +++ b/usr/share/plymouth/themes/parch/boot.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + diff --git a/usr/share/plymouth/themes/parch/box.png b/usr/share/plymouth/themes/parch/box.png new file mode 100644 index 0000000..713b63c Binary files /dev/null and b/usr/share/plymouth/themes/parch/box.png differ diff --git a/usr/share/plymouth/themes/parch/bullet.png b/usr/share/plymouth/themes/parch/bullet.png new file mode 100644 index 0000000..2202446 Binary files /dev/null and b/usr/share/plymouth/themes/parch/bullet.png differ diff --git a/usr/share/plymouth/themes/parch/entry.png b/usr/share/plymouth/themes/parch/entry.png new file mode 100644 index 0000000..84fc70f Binary files /dev/null and b/usr/share/plymouth/themes/parch/entry.png differ diff --git a/usr/share/plymouth/themes/parch/lock.png b/usr/share/plymouth/themes/parch/lock.png new file mode 100644 index 0000000..642c9b9 Binary files /dev/null and b/usr/share/plymouth/themes/parch/lock.png differ diff --git a/usr/share/plymouth/themes/parch/parch.plymouth b/usr/share/plymouth/themes/parch/parch.plymouth new file mode 100644 index 0000000..a9ba479 --- /dev/null +++ b/usr/share/plymouth/themes/parch/parch.plymouth @@ -0,0 +1,8 @@ +[Plymouth Theme] +Name=Parch +Description=ParchLinux plymouth theme +ModuleName=script + +[script] +ImageDir=/usr/share/plymouth/themes/parch +ScriptFile=/usr/share/plymouth/themes/parch/parch.script diff --git a/usr/share/plymouth/themes/parch/parch.script b/usr/share/plymouth/themes/parch/parch.script new file mode 100644 index 0000000..6acbf68 --- /dev/null +++ b/usr/share/plymouth/themes/parch/parch.script @@ -0,0 +1,207 @@ + + +logo.image = Image("boot.png"); +Window.SetBackgroundTopColor(0, 0, 0); +Window.SetBackgroundBottomColor(0, 0, 0); + +if (Plymouth.GetMode () == "shutdown") +# To increase the possibility of certain shutdown messages we do a little math + +{ + a = Math.Random (); + if (a <= 0.5) + if (a <= 0.25) + if (a <= 0.125) + if (a <= 0.0625) + if (a <= 0.03125) + logo.image = Image("shutdown1.png"); + else + logo.image = Image("shutdown2.png"); + else + logo.image = Image("shutdown3.png"); + + else + logo.image = Image("shutdown4.png"); + + else + logo.image = Image("shutdown5.png"); + + else + logo.image = Image("shutdown6.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); # original +logoYPosShutdownMode = Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2; +#logo.sprite.SetY (Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 1); # my change +logoYPosBootMode = Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 1; + +# Set different Y position for logo for different modes +if (Plymouth.GetMode () == "shutdown") +{ + logo.sprite.SetY (logoYPosShutdownMode); +} +else +{ + # in boot mode + logo.sprite.SetY (logoYPosBootMode); +} + +logo.sprite.SetOpacity (1); + +#----------------------------------------- Dialogue -------------------------------- + +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.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2; + box.y = Window.GetY() + 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); + +#----------------------------------------- Progress Bar -------------------------------- + +if (Plymouth.GetMode () == "boot") +{ + 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; + #change here + #progress_box.y = Window.GetY() + Window.GetHeight() * 0.65 - progress_box.image.GetHeight() / 2; + progress_box.y = Window.GetY() + Window.GetHeight() * 0.55 - progress_box.image.GetHeight() / 2; # my change + progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0); + + progress_bar.original_image = Image("progress_bar.png"); + progress_bar.sprite = Sprite(); + + progress_bar.x = Window.GetX() + Window.GetWidth() / 2 - progress_bar.original_image.GetWidth() / 2; + #change here + #progress_bar.y = Window.GetY() + Window.GetHeight() / 2 * 1.3 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2; + progress_bar.y = Window.GetY() + Window.GetHeight() / 2 * 1.1 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2; # my change + progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1); + + fun progress_callback (duration, progress) + { + if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress)) + { + progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight()); + progress_bar.sprite.SetImage (progress_bar.image); + } + } + + Plymouth.SetBootProgressFunction(progress_callback); +} + +#----------------------------------------- Quit -------------------------------- + +fun quit_callback () +{ + logo.sprite.SetOpacity (1); +} + +Plymouth.SetQuitFunction(quit_callback); + +#----------------------------------------- Message -------------------------------- + +message_sprites = []; +message_sprite_count = 0; +message_sprite_y = 10; + +fun display_message_callback (text) +{ + my_image = Image.Text(text, 1, 1, 1); + message_sprites[message_sprite_count] = Sprite(my_image); + message_sprites[message_sprite_count].SetPosition(10, message_sprite_y, 10000); + message_sprites[message_sprite_count].text = text; + message_sprite_count++; + message_sprite_y += my_image.GetHeight(); +} + +fun hide_message_callback (text) +{ + for (i = 0; i < message_sprite_count; i++) + { + if (message_sprites[i].text == text) + message_sprites[i] = NULL; + } +} + +Plymouth.SetDisplayMessageFunction (display_message_callback); +Plymouth.SetHideMessageFunction (hide_message_callback); diff --git a/usr/share/plymouth/themes/parch/preview.sh b/usr/share/plymouth/themes/parch/preview.sh new file mode 100755 index 0000000..c11cdb6 --- /dev/null +++ b/usr/share/plymouth/themes/parch/preview.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ $EUID -ne 0 ]; then + echo ERROR: You must run this as root + exit +fi + +plymouthd +plymouth --show-splash +sleep ${1:-2} +plymouth quit diff --git a/usr/share/plymouth/themes/parch/progress_bar.png b/usr/share/plymouth/themes/parch/progress_bar.png new file mode 100644 index 0000000..3aa9dc6 Binary files /dev/null and b/usr/share/plymouth/themes/parch/progress_bar.png differ diff --git a/usr/share/plymouth/themes/parch/progress_box.png b/usr/share/plymouth/themes/parch/progress_box.png new file mode 100644 index 0000000..553a61a Binary files /dev/null and b/usr/share/plymouth/themes/parch/progress_box.png differ diff --git a/usr/share/plymouth/themes/parch/shutdown1.png b/usr/share/plymouth/themes/parch/shutdown1.png new file mode 120000 index 0000000..ab74974 --- /dev/null +++ b/usr/share/plymouth/themes/parch/shutdown1.png @@ -0,0 +1 @@ +boot.png \ No newline at end of file diff --git a/usr/share/plymouth/themes/parch/shutdown2.png b/usr/share/plymouth/themes/parch/shutdown2.png new file mode 120000 index 0000000..ab74974 --- /dev/null +++ b/usr/share/plymouth/themes/parch/shutdown2.png @@ -0,0 +1 @@ +boot.png \ No newline at end of file diff --git a/usr/share/plymouth/themes/parch/shutdown3.png b/usr/share/plymouth/themes/parch/shutdown3.png new file mode 120000 index 0000000..ab74974 --- /dev/null +++ b/usr/share/plymouth/themes/parch/shutdown3.png @@ -0,0 +1 @@ +boot.png \ No newline at end of file diff --git a/usr/share/plymouth/themes/parch/shutdown4.png b/usr/share/plymouth/themes/parch/shutdown4.png new file mode 120000 index 0000000..ab74974 --- /dev/null +++ b/usr/share/plymouth/themes/parch/shutdown4.png @@ -0,0 +1 @@ +boot.png \ No newline at end of file diff --git a/usr/share/plymouth/themes/parch/shutdown5.png b/usr/share/plymouth/themes/parch/shutdown5.png new file mode 120000 index 0000000..ab74974 --- /dev/null +++ b/usr/share/plymouth/themes/parch/shutdown5.png @@ -0,0 +1 @@ +boot.png \ No newline at end of file diff --git a/usr/share/plymouth/themes/parch/shutdown6.png b/usr/share/plymouth/themes/parch/shutdown6.png new file mode 120000 index 0000000..ab74974 --- /dev/null +++ b/usr/share/plymouth/themes/parch/shutdown6.png @@ -0,0 +1 @@ +boot.png \ No newline at end of file