commit e9b25f120ddfbb13ef689e4d89b51423d7681c38 Author: Alexis Fourmaux Date: Thu May 21 01:18:35 2020 +0200 Initial commit with simple update of color theme diff --git a/arch-nord.plymouth b/arch-nord.plymouth new file mode 100644 index 0000000..fc5820d --- /dev/null +++ b/arch-nord.plymouth @@ -0,0 +1,8 @@ +[Plymouth Theme] +Name=Arch Nord +Description=Arch Nord theme. +ModuleName=script + +[script] +ImageDir=/usr/share/plymouth/themes/arch-nord +ScriptFile=/usr/share/plymouth/themes/arch-nord/arch-nord.script diff --git a/arch-nord.script b/arch-nord.script new file mode 100644 index 0000000..26e6c0b --- /dev/null +++ b/arch-nord.script @@ -0,0 +1,135 @@ +// Screen size +screen.w = Window.GetWidth(); +screen.h = Window.GetHeight(); +screen.half.w = Window.GetWidth() / 2; +screen.half.h = Window.GetHeight() / 2; + +// Logo +logo.image = Image("logo.png"); +logo.originalImage = Image("logo.png"); +logo.sprite = Sprite(); + +// BG +Window.SetBackgroundTopColor(0.18, 0.20, 0.25); +Window.SetBackgroundBottomColor(0.18, 0.20, 0.25); + +// Progress bar +loading.image = Image("progress.png"); +loading.originalImage = Image("progress.png"); +loading.sprite = Sprite(); +loading.sprite.SetY(screen.h - 1); +loading.sprite.SetX(0); + +// Question prompt +question = null; +answer = null; + +// Message +message = null; + +// Password prompt +bullets = null; +prompt = null; +bullet.image = Image.Text("*", 1, 1, 1); + +// Flow +state.status = "play"; +state.time = 0.0; + +//--------------------------------- Refresh (Logo animation) -------------------------- +fun RefreshCallback() { + if (state.status == "play") + speed = 5; + else + speed = 1; + + if (Plymouth.GetMode() == "shutdown") + opacity = 1 - global.progress * 3; + else + opacity = 1; + + sin = Math.Sin(state.time * speed) * 0.05; + if (sin < 0) + sin *= 2; + s = Math.Abs(sin) + 0.3; + + logo.image = logo.originalImage.Scale( + logo.originalImage.GetWidth() * s, + logo.originalImage.GetHeight() * s + ); + logo.sprite.SetImage(logo.image); + logo.sprite.SetX(screen.half.w - logo.image.GetWidth() / 2); + logo.sprite.SetY(screen.half.h - logo.image.GetHeight() / 2); + logo.sprite.SetOpacity(opacity); + + loading.image = loading.originalImage.Scale(global.progress * screen.w, 1); + loading.sprite.SetImage(loading.image); +} +Plymouth.SetRefreshFunction(RefreshCallback); + +//------------------------------------- Password prompt ------------------------------- +fun DisplayQuestionCallback(prompt, entry) { + question = null; + answer = null; + + if (entry == "") + entry = ""; + + question.image = Image.Text(prompt, 1, 1, 1); + question.sprite = Sprite(question.image); + question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2); + question.sprite.SetY(screen.h - 4 * question.image.GetHeight()); + + answer.image = Image.Text(entry, 1, 1, 1); + answer.sprite = Sprite(answer.image); + answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2); + answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight()); +} +Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback); + +//------------------------------------- Password prompt ------------------------------- +fun DisplayPasswordCallback(nil, bulletCount) { + state.status = "pause"; + totalWidth = bulletCount * bullet.image.GetWidth(); + startPos = screen.half.w - totalWidth / 2; + + prompt.image = Image.Text("enter password:", 1, 1, 1); + prompt.sprite = Sprite(prompt.image); + prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2); + prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight()); + + // Clear all bullets (user might hit backspace) + bullets = null; + for (i = 0; i < bulletCount; i++) { + bullets[i].sprite = Sprite(bullet.image); + bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth()); + bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight()); + } +} +Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback); + +//--------------------------- Normal display (unset all text) ---------------------- +fun DisplayNormalCallback() { + state.status = "play"; + bullets = null; + prompt = null; + message = null; + question = null; + answer = null; +} +Plymouth.SetDisplayNormalFunction(DisplayNormalCallback); + +//----------------------------------------- Progress -------------------------------- +fun ProgressCallback(duration, progress) { + global.progress = progress; + state.time = duration; +} +Plymouth.SetBootProgressFunction(ProgressCallback); + +//----------------------------------------- Message -------------------------------- +fun MessageCallback(text) { + message.image = Image.Text(text, 1, 1, 1); + message.sprite = Sprite(message.image); + message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight()); +} +Plymouth.SetMessageFunction(MessageCallback); diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..80d8646 Binary files /dev/null and b/logo.png differ diff --git a/progress.png b/progress.png new file mode 100644 index 0000000..2694660 Binary files /dev/null and b/progress.png differ