Skip to content

Commit

Permalink
🎉 Made arch plymouth theme
Browse files Browse the repository at this point in the history
  • Loading branch information
yozachar committed Apr 16, 2024
0 parents commit 184eb39
Show file tree
Hide file tree
Showing 18 changed files with 326 additions and 0 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2021 Jovial Joe Jayarson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Aregression

[![Open Source Love png1](https://badges.frapsoft.com/os/v1/open-source.png?v=103)](https://opensource.org/) [![Gitmoji](https://img.shields.io/badge/gitmoji-%20😎-FFDD67.svg)](https://gitmoji.dev/) [![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/iesdevs/iedc/pulls)

A sleek boot up progress bar for Arch Linux

## Installing

Follow instruction on [ArchWiki](https://wiki.archlinux.org/title/plymouth) to install and setup Plymouth.

### AUR (Coming soon!)

### Manual

- Clone this repository:

```bash
➜ sudo git clone https://github.com/joe733/aregression /usr/share/plymouth/themes/aregression
```

### Usage

This is well documented in the same ArchWiki page. Nevertheless you can execute the following commands:

- List all themes

```bash
➜ sudo plymouth-set-default-theme -l # You should see aregression listed
```

- Change theme test theme

```bash
➜ sudo plymouth-set-default-theme aregression
➜ sudo plymouthd # Start plymouthd
➜ sudo plymouth --show-splash # Use Ctrl + Alt + F6 to quit
➜ sudo plymouth --quit # Quit plymouthd
```

- If everything is fine update initramfs

```bash
➜ sudo plymouth-set-default-theme -R aregression
# OR
➜ mkinitcpio -P
```

## Removal

### AUR (Coming Soon!)

### Manual (Not recommended if installed via AUR)

- Remove the theme folder

```bash
➜ sudo mv /usr/share/plymouth/themes/aregression ~/
➜ sudo rm -rf ~/aregression # ⚠️ Dangerous command! Double check your directory!
```

## Credits

- Original Project [Darwin Plymouth Theme](https://www.gnome-look.org/content/show.php/Darwin+Plymouth?content=170649)
- Derived from [ubuntu-darwin](https://github.com/ashutoshgngwr/ubuntu-darwin)
- Inspired by [arch-beat](https://github.com/nenad/arch-beat) and [arch10](https://github.com/manilarome/plymouth-theme-arch10)
8 changes: 8 additions & 0 deletions aregression.plymouth
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Plymouth Theme]
Name=Aregression Plymouth
Description=Sleek boot up progress bar
ModuleName=script

[script]
ImageDir=/usr/share/plymouth/themes/aregression/assets
ScriptFile=/usr/share/plymouth/themes/aregression/assets/aregression.script
Binary file added assets/.aregression.script.swp
Binary file not shown.
Binary file added assets/animation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
244 changes: 244 additions & 0 deletions assets/aregression.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
Window.GetMaxWidth = fun (){
i = 0;
width = 0;
while (Window.GetWidth(i)){
width = Math.Max(width, Window.GetWidth(i));
i++;
}
return width;
};

Window.GetMaxHeight = fun (){
i = 0;
height = 0;
while (Window.GetHeight(i)){
height = Math.Max(height, Window.GetHeight(i));
i++;
}
return height;
};

anim.imagecount = 32;
anim.target_width = 0.2* 0.46 * Window.GetWidth();
anim.target_height = 0.2* 0.46 * Window.GetWidth();

fun RotatedImage (index){
index = Math.Int(index);
if (!RotatedImageCache[index])
RotatedImageCache[index] = anim.original_image.Rotate((Math.Pi*2*index)/anim.imagecount).Scale(anim.target_width, anim.target_height);

return RotatedImageCache[index];
}


if (Plymouth.GetMode() == "suspend" || Plymouth.GetMode() == "resume") {
background.original_image = ImageNew("suspend.png");
Window.SetBackgroundTopColor(1, 0, 0);
Window.SetBackgroundBottomColor(0, 1, 0);
}
else {
logo.original_image = ImageNew("logo.png");
background.original_image = ImageNew("background.png");
Window.SetBackgroundTopColor(0.180, 0.545, 0.020);
Window.SetBackgroundBottomColor(0.439, 0.573, 0.333);

anim.image= ImageNew("animation.png");
anim.original_image= anim.image.Scale(anim.target_width, anim.target_width);

anim.sprite = SpriteNew();
anim.sprite.SetImage(RotatedImage (0));
anim.sprite.SetX((Window.GetX() + Window.GetWidth() - RotatedImage(0).GetWidth()) / 2);
anim.sprite.SetY(Window.GetY() + Window.GetHeight() * 0.37);
anim.angle = 0;
anim.index = 0;


}

ratio = logo.original_image.GetWidth() / logo.original_image.GetHeight();
reduction = 0.4;
logo.image = logo.original_image.Scale(reduction * Window.GetMaxWidth() , reduction / ratio * Window.GetMaxWidth());
logo.sprite = SpriteNew();
logo.sprite.SetImage(logo.image);
logo.opacity_angle = 0;
logo.sprite.SetX((Window.GetX() + Window.GetMaxWidth() - logo.image.GetWidth()) / 2);
logo.sprite.SetY(Window.GetY() + Window.GetHeight() * 0.37);

background.image = background.original_image.Scale(Window.GetMaxWidth() , Window.GetMaxHeight());
background.sprite = SpriteNew();
background.sprite.SetImage(background.image);
background.sprite.SetPosition(Window.GetX(), Window.GetY(), -10);

sprite_prompt = SpriteNew();

fun refresh_callback ()
{
if (status == "normal")
{
anim.index += 1;
anim.index %= anim.imagecount;
anim.sprite.SetImage(RotatedImage (anim.index));
#anim.sprite.SetOpacity (1);
#motif.sprite.SetOpacity(motif.opacity);
}
else
{
anim.sprite.SetOpacity(0);
motif.sprite.SetOpacity(0);
}

}

if (Plymouth.GetMode() != "suspend" && Plymouth.GetMode() != "resume") {
Plymouth.SetRefreshFunction (refresh_callback);
}

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

status = "normal";

fun dialog_setup()
{
local.box;
local.lock;
local.entry;
local.prompt_sprite;

box.image = ImageNew("box.png");
lock.image = ImageNew("lock.png");
entry.image = ImageNew("entry.png");

box.sprite = SpriteNew();
box.sprite.SetImage(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 = SpriteNew();
lock.sprite.SetImage(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 = SpriteNew();
entry.sprite.SetImage(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);

prompt_sprite = SpriteNew();
prompt_sprite.SetPosition(box.x, box.y - 20, box.z);

global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = ImageNew("bullet.png");
global.dialog.prompt_sprite = prompt_sprite;
dialog_opacity (1);
}

fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity(opacity);
dialog.lock.sprite.SetOpacity(opacity);
dialog.entry.sprite.SetOpacity(opacity);
dialog.prompt_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);
motif.sprite.SetOpacity(0);
anim.sprite.SetOpacity(0);

dialog.prompt_sprite.SetImage(Image.Text(prompt, 1.0, 1.0, 1.0));
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{

if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = SpriteNew();
dialog.bullet[index].sprite.SetImage(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);
}
}

fun display_message_callback (prompt)
{

prompt = Image.Text(prompt,1.0, 1.0, 1.0);
sprite_prompt.SetImage(prompt);
sprite_prompt.SetPosition(Window.GetX() + (Window.GetWidth() - prompt.GetWidth()) / 2, Window.GetY() + Window.GetHeight() * 0.93, 2);
}

/* instantiate dialog at startup, to ensure all icons are loaded in memory before initrd is unmounted, in case /usr isn't mounted yet */
dialog_setup(); dialog_opacity(0);
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
Plymouth.SetMessageFunction(display_message_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 = Window.GetY() + Window.GetHeight() * 0.65 - progress_box.image.GetHeight() / 2;
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;
progress_bar.y = Window.GetY() + Window.GetHeight() * 0.65 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
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 ()
{
anim.sprite.SetOpacity (0);
if (Plymouth.GetMode() == "shutdown") {
motif.sprite.SetOpacity(0);
}
}

Plymouth.SetQuitFunction(quit_callback);

Binary file added assets/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/entry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/motif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/progress_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/progress_box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/progress_box_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/progress_box_edge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/suspend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 184eb39

Please sign in to comment.