Remove excess themes and move tokyo-night
@ -1,210 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Omarchy Plymouth Theme Generator
|
|
||||||
# This script uses ImageMagick to recolor PNG assets from tokyo-night plymouth theme
|
|
||||||
# Usage: omarchy-generate-plymouth-theme --background=#24273a --foreground=#cad3f5 --progress-background=#343849 --progress-foreground=#cad3f5 --logo=#a6da95 --destination=catppuccin
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Check if ImageMagick is installed
|
|
||||||
if ! command -v magick &>/dev/null; then
|
|
||||||
echo "ImageMagick 7+ is required but not installed. Please install it first:"
|
|
||||||
echo "yay -S imagemagick"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Base directory
|
|
||||||
THEMES_DIR="$HOME/.local/share/omarchy/themes"
|
|
||||||
|
|
||||||
# Default values (tokyo-night colors)
|
|
||||||
BACKGROUND="#1a1b26"
|
|
||||||
FOREGROUND="#c0caf5"
|
|
||||||
PROGRESS_BACKGROUND="#343849"
|
|
||||||
PROGRESS_FOREGROUND="#7aa2f7"
|
|
||||||
LOGO="#7aa2f7"
|
|
||||||
DESTINATION=""
|
|
||||||
|
|
||||||
# Function to show usage
|
|
||||||
show_usage() {
|
|
||||||
echo "Usage: $0 --background=<hex> --foreground=<hex> --progress-background=<hex> --progress-foreground=<hex> --logo=<hex> --destination=<name>"
|
|
||||||
echo
|
|
||||||
echo "Parameters:"
|
|
||||||
echo " --background Background color (hex format, e.g., #24273a)"
|
|
||||||
echo " --foreground Foreground color (hex format, e.g., #cad3f5)"
|
|
||||||
echo " --progress-background Progress bar background color (hex format, e.g., #343849)"
|
|
||||||
echo " --progress-foreground Progress bar foreground color (hex format, e.g., #cad3f5)"
|
|
||||||
echo " --logo Logo color (hex format, e.g., #a6da95)"
|
|
||||||
echo " --destination Destination theme name (e.g., catppuccin)"
|
|
||||||
echo
|
|
||||||
echo "Example:"
|
|
||||||
echo " $0 --background=#24273a --foreground=#cad3f5 --progress-background=#343849 --progress-foreground=#cad3f5 --logo=#a6da95 --destination=catppuccin"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parse command line arguments
|
|
||||||
for arg in "$@"; do
|
|
||||||
case $arg in
|
|
||||||
--background=*)
|
|
||||||
BACKGROUND="${arg#*=}"
|
|
||||||
;;
|
|
||||||
--foreground=*)
|
|
||||||
FOREGROUND="${arg#*=}"
|
|
||||||
;;
|
|
||||||
--progress-background=*)
|
|
||||||
PROGRESS_BACKGROUND="${arg#*=}"
|
|
||||||
;;
|
|
||||||
--progress-foreground=*)
|
|
||||||
PROGRESS_FOREGROUND="${arg#*=}"
|
|
||||||
;;
|
|
||||||
--logo=*)
|
|
||||||
LOGO="${arg#*=}"
|
|
||||||
;;
|
|
||||||
--destination=*)
|
|
||||||
DESTINATION="${arg#*=}"
|
|
||||||
;;
|
|
||||||
--help | -h)
|
|
||||||
show_usage
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown parameter: $arg"
|
|
||||||
show_usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if destination is provided
|
|
||||||
if [[ -z "$DESTINATION" ]]; then
|
|
||||||
echo "Error: --destination parameter is required"
|
|
||||||
show_usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Convert hex to RGB values for Plymouth script
|
|
||||||
hex_to_rgb() {
|
|
||||||
local hex="$1"
|
|
||||||
# Remove # if present
|
|
||||||
hex="${hex#\#}"
|
|
||||||
|
|
||||||
# Convert to decimal
|
|
||||||
local r=$((16#${hex:0:2}))
|
|
||||||
local g=$((16#${hex:2:2}))
|
|
||||||
local b=$((16#${hex:4:2}))
|
|
||||||
|
|
||||||
# Convert to 0-1 range with 3 decimal places
|
|
||||||
printf "%.3f\n" $(awk "BEGIN {print $r/255}")
|
|
||||||
printf "%.3f\n" $(awk "BEGIN {print $g/255}")
|
|
||||||
printf "%.3f\n" $(awk "BEGIN {print $b/255}")
|
|
||||||
}
|
|
||||||
|
|
||||||
# Convert hex to Plymouth hex format (0xRRGGBB)
|
|
||||||
hex_to_plymouth() {
|
|
||||||
local hex="$1"
|
|
||||||
# Remove # if present and prepend 0x
|
|
||||||
hex="${hex#\#}"
|
|
||||||
echo "0x${hex}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to recolor an image
|
|
||||||
recolor_image() {
|
|
||||||
local input="$1"
|
|
||||||
local output="$2"
|
|
||||||
local color="$3"
|
|
||||||
local operation="$4"
|
|
||||||
|
|
||||||
case "$operation" in
|
|
||||||
"fill")
|
|
||||||
# Simple fill with color (for lock, bullet, progress_bar, progress_box, logo, throbber)
|
|
||||||
# Use -strip to remove EXIF data and avoid warnings
|
|
||||||
magick "$input" -strip -fill "$color" -colorize 100% "$output" 2>/dev/null
|
|
||||||
;;
|
|
||||||
"entry")
|
|
||||||
# Create semi-transparent black with colored border
|
|
||||||
# First get dimensions
|
|
||||||
dims=$(magick identify -format "%wx%h" "$input")
|
|
||||||
width=$(echo $dims | cut -d'x' -f1)
|
|
||||||
height=$(echo $dims | cut -d'x' -f2)
|
|
||||||
|
|
||||||
# Create new image with transparent background, semi-transparent black fill, and colored border
|
|
||||||
magick -size ${width}x${height} xc:transparent \
|
|
||||||
-fill "rgba(0,0,0,0.05)" -draw "rectangle 0,0 $((width - 1)),$((height - 1))" \
|
|
||||||
-fill none -stroke "$color" -strokewidth 2 -draw "rectangle 1,1 $((width - 2)),$((height - 2))" \
|
|
||||||
"$output"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# Source and destination directories
|
|
||||||
SOURCE_DIR="${THEMES_DIR}/tokyo-night/plymouth"
|
|
||||||
DEST_DIR="${THEMES_DIR}/${DESTINATION}/plymouth"
|
|
||||||
|
|
||||||
# Check if source exists
|
|
||||||
if [[ ! -d "$SOURCE_DIR" ]]; then
|
|
||||||
echo "Error: Tokyo Night theme not found at $SOURCE_DIR"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Plymouth Asset Recoloring Script"
|
|
||||||
echo "================================"
|
|
||||||
echo
|
|
||||||
echo "Configuration:"
|
|
||||||
echo " Background: $BACKGROUND"
|
|
||||||
echo " Foreground: $FOREGROUND"
|
|
||||||
echo " Progress Background: $PROGRESS_BACKGROUND"
|
|
||||||
echo " Progress Foreground: $PROGRESS_FOREGROUND"
|
|
||||||
echo " Logo: $LOGO"
|
|
||||||
echo " Destination: $DESTINATION"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Create destination directory
|
|
||||||
echo "Creating destination directory: $DEST_DIR"
|
|
||||||
mkdir -p "$DEST_DIR"
|
|
||||||
|
|
||||||
# Copy all files from tokyo-night
|
|
||||||
echo "Copying files from tokyo-night theme..."
|
|
||||||
cp -r "$SOURCE_DIR"/* "$DEST_DIR/"
|
|
||||||
|
|
||||||
# Update omarchy.plymouth with background color
|
|
||||||
echo "Updating omarchy.plymouth..."
|
|
||||||
PLYMOUTH_BG=$(hex_to_plymouth "$BACKGROUND")
|
|
||||||
sed -i "s/ConsoleLogBackgroundColor=.*/ConsoleLogBackgroundColor=${PLYMOUTH_BG}/" "$DEST_DIR/omarchy.plymouth"
|
|
||||||
|
|
||||||
# Update omarchy.script with background color
|
|
||||||
echo "Updating omarchy.script..."
|
|
||||||
RGB=($(hex_to_rgb "$BACKGROUND"))
|
|
||||||
sed -i "s/Window.SetBackgroundTopColor(.*);/Window.SetBackgroundTopColor(${RGB[0]}, ${RGB[1]}, ${RGB[2]});/" "$DEST_DIR/omarchy.script"
|
|
||||||
sed -i "s/Window.SetBackgroundBottomColor(.*);/Window.SetBackgroundBottomColor(${RGB[0]}, ${RGB[1]}, ${RGB[2]});/" "$DEST_DIR/omarchy.script"
|
|
||||||
|
|
||||||
# Recolor assets
|
|
||||||
echo "Recoloring assets..."
|
|
||||||
|
|
||||||
# Recolor lock.png
|
|
||||||
echo " - Recoloring lock.png with $FOREGROUND"
|
|
||||||
recolor_image "$DEST_DIR/lock.png" "$DEST_DIR/lock.png" "$FOREGROUND" "fill"
|
|
||||||
|
|
||||||
# Recolor bullet.png
|
|
||||||
echo " - Recoloring bullet.png with $FOREGROUND"
|
|
||||||
recolor_image "$DEST_DIR/bullet.png" "$DEST_DIR/bullet.png" "$FOREGROUND" "fill"
|
|
||||||
|
|
||||||
# Recolor progress_bar.png
|
|
||||||
echo " - Recoloring progress_bar.png with $PROGRESS_FOREGROUND"
|
|
||||||
recolor_image "$DEST_DIR/progress_bar.png" "$DEST_DIR/progress_bar.png" "$PROGRESS_FOREGROUND" "fill"
|
|
||||||
|
|
||||||
# Recolor progress_box.png
|
|
||||||
echo " - Recoloring progress_box.png with $PROGRESS_BACKGROUND"
|
|
||||||
recolor_image "$DEST_DIR/progress_box.png" "$DEST_DIR/progress_box.png" "$PROGRESS_BACKGROUND" "fill"
|
|
||||||
|
|
||||||
# Recolor entry.png
|
|
||||||
echo " - Creating entry.png with 5% black and $FOREGROUND border"
|
|
||||||
recolor_image "$DEST_DIR/entry.png" "$DEST_DIR/entry.png" "$FOREGROUND" "entry"
|
|
||||||
|
|
||||||
# Recolor logo.png (using fill instead of tint)
|
|
||||||
echo " - Recoloring logo.png with $LOGO"
|
|
||||||
recolor_image "$DEST_DIR/logo.png" "$DEST_DIR/logo.png" "$LOGO" "fill"
|
|
||||||
|
|
||||||
# Recolor throbber frames
|
|
||||||
echo " - Recoloring throbber frames (1-30) with $FOREGROUND"
|
|
||||||
for i in {1..30}; do
|
|
||||||
frame_file=$(printf "throbber-%02d.png" $i)
|
|
||||||
recolor_image "$DEST_DIR/$frame_file" "$DEST_DIR/$frame_file" "$FOREGROUND" "fill" 2>/dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "✓ Plymouth theme for $DESTINATION has been created successfully!"
|
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 694 B After Width: | Height: | Size: 694 B |
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 694 B |
Before Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 1.4 KiB |
@ -1,11 +0,0 @@
|
|||||||
[Plymouth Theme]
|
|
||||||
Name=Omarchy
|
|
||||||
Description=Script example plugin.
|
|
||||||
ModuleName=script
|
|
||||||
|
|
||||||
[script]
|
|
||||||
ImageDir=/usr/share/plymouth/themes/omarchy
|
|
||||||
ScriptFile=/usr/share/plymouth/themes/omarchy/omarchy.script
|
|
||||||
ConsoleLogBackgroundColor=0x24273a
|
|
||||||
|
|
||||||
|
|
@ -1,236 +0,0 @@
|
|||||||
# Omarchy Plymouth Theme Script
|
|
||||||
Window.SetBackgroundTopColor(0.141, 0.153, 0.227);
|
|
||||||
Window.SetBackgroundBottomColor(0.141, 0.153, 0.227);
|
|
||||||
|
|
||||||
logo.image = Image("logo.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);
|
|
||||||
logo.sprite.SetOpacity (1);
|
|
||||||
|
|
||||||
fun refresh_callback ()
|
|
||||||
{
|
|
||||||
# Always animate spinner - it will be invisible when not needed
|
|
||||||
if (global.spinner_sprite)
|
|
||||||
{
|
|
||||||
global.spinner_frame++;
|
|
||||||
frame_index = Math.Int(global.spinner_frame / 3) % global.spinner_frame_count;
|
|
||||||
global.spinner_sprite.SetImage(global.spinner_images[frame_index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetRefreshFunction (refresh_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Dialogue --------------------------------
|
|
||||||
|
|
||||||
status = "normal";
|
|
||||||
|
|
||||||
fun dialog_setup()
|
|
||||||
{
|
|
||||||
local.lock;
|
|
||||||
local.entry;
|
|
||||||
|
|
||||||
lock.image = Image("lock.png");
|
|
||||||
entry.image = Image("entry.png");
|
|
||||||
|
|
||||||
entry.sprite = Sprite(entry.image);
|
|
||||||
entry.x = Window.GetX() + Window.GetWidth()/2 - entry.image.GetWidth() / 2;
|
|
||||||
entry.y = logo.sprite.GetY() + logo.image.GetHeight() + 40;
|
|
||||||
entry.z = 10001;
|
|
||||||
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
|
|
||||||
|
|
||||||
lock.sprite = Sprite(lock.image);
|
|
||||||
lock.x = entry.x - lock.image.GetWidth() - 10;
|
|
||||||
lock.y = logo.sprite.GetY() + logo.image.GetHeight() + 40 + entry.image.GetHeight()/2 - lock.image.GetHeight()/2;
|
|
||||||
lock.z = 10001;
|
|
||||||
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
|
|
||||||
|
|
||||||
global.dialog.lock = lock;
|
|
||||||
global.dialog.entry = entry;
|
|
||||||
global.dialog.bullet_image = Image("bullet.png");
|
|
||||||
dialog_opacity (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun dialog_opacity(opacity)
|
|
||||||
{
|
|
||||||
global.dialog.lock.sprite.SetOpacity (opacity);
|
|
||||||
global.dialog.entry.sprite.SetOpacity (opacity);
|
|
||||||
for (index = 0; global.dialog.bullet[index]; index++)
|
|
||||||
{
|
|
||||||
global.dialog.bullet[index].sprite.SetOpacity(opacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun display_normal_callback ()
|
|
||||||
{
|
|
||||||
global.status = "normal";
|
|
||||||
if (global.dialog)
|
|
||||||
dialog_opacity (0);
|
|
||||||
spinner_show(); # Show spinner when no password dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
fun display_password_callback (prompt, bullets)
|
|
||||||
{
|
|
||||||
global.status = "password";
|
|
||||||
|
|
||||||
# Always hide spinner when showing password dialog
|
|
||||||
spinner_hide();
|
|
||||||
|
|
||||||
# Setup dialog if it doesn't exist
|
|
||||||
if (!global.dialog)
|
|
||||||
dialog_setup();
|
|
||||||
else
|
|
||||||
dialog_opacity(1);
|
|
||||||
|
|
||||||
# Clear all bullets first (user might hit backspace)
|
|
||||||
for (index = 0; global.dialog.bullet[index]; index++)
|
|
||||||
{
|
|
||||||
global.dialog.bullet[index].sprite.SetOpacity(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create and show bullets for current password
|
|
||||||
for (index = 0; index < bullets; index++)
|
|
||||||
{
|
|
||||||
if (!global.dialog.bullet[index])
|
|
||||||
{
|
|
||||||
global.dialog.bullet[index].sprite = Sprite(global.dialog.bullet_image);
|
|
||||||
global.dialog.bullet[index].x = global.dialog.entry.x + 10 + index * (global.dialog.bullet_image.GetWidth() + 5);
|
|
||||||
global.dialog.bullet[index].y = global.dialog.entry.y + global.dialog.entry.image.GetHeight() / 2 - global.dialog.bullet_image.GetHeight() / 2;
|
|
||||||
global.dialog.bullet[index].z = global.dialog.entry.z + 1;
|
|
||||||
global.dialog.bullet[index].sprite.SetPosition(global.dialog.bullet[index].x, global.dialog.bullet[index].y, global.dialog.bullet[index].z);
|
|
||||||
}
|
|
||||||
global.dialog.bullet[index].sprite.SetOpacity(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetDisplayNormalFunction(display_normal_callback);
|
|
||||||
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Spinner --------------------------------
|
|
||||||
|
|
||||||
global.spinner_sprite = NULL;
|
|
||||||
global.spinner_frame = 0;
|
|
||||||
global.spinner_frame_count = 30;
|
|
||||||
global.spinner_visible = false;
|
|
||||||
global.spinner_images = [];
|
|
||||||
|
|
||||||
fun spinner_setup()
|
|
||||||
{
|
|
||||||
if (!global.spinner_sprite)
|
|
||||||
{
|
|
||||||
# Load all throbber frames
|
|
||||||
for (i = 1; i <= global.spinner_frame_count; i++)
|
|
||||||
{
|
|
||||||
if (i < 10)
|
|
||||||
filename = "throbber-000" + i + ".png";
|
|
||||||
else
|
|
||||||
filename = "throbber-00" + i + ".png";
|
|
||||||
global.spinner_images[i-1] = Image(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create spinner sprite
|
|
||||||
global.spinner_sprite = Sprite(global.spinner_images[0]);
|
|
||||||
global.spinner_x = Window.GetX() + Window.GetWidth() / 2 - global.spinner_images[0].GetWidth() / 2;
|
|
||||||
global.spinner_y = Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2 + logo.image.GetHeight() + 40;
|
|
||||||
global.spinner_sprite.SetPosition(global.spinner_x, global.spinner_y, 10002);
|
|
||||||
global.spinner_sprite.SetOpacity(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun spinner_show()
|
|
||||||
{
|
|
||||||
if (global.spinner_sprite)
|
|
||||||
{
|
|
||||||
global.spinner_sprite.SetOpacity(1);
|
|
||||||
global.spinner_visible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun spinner_hide()
|
|
||||||
{
|
|
||||||
if (global.spinner_sprite)
|
|
||||||
{
|
|
||||||
global.spinner_sprite.SetOpacity(0);
|
|
||||||
global.spinner_visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Initialize spinner
|
|
||||||
spinner_setup();
|
|
||||||
#----------------------------------------- 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.75 - progress_box.image.GetHeight() / 2;
|
|
||||||
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
|
|
||||||
progress_box.sprite.SetOpacity(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() / 2 * 1.5 - 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);
|
|
||||||
progress_bar.sprite.SetOpacity(0);
|
|
||||||
|
|
||||||
global.progress_visible = false;
|
|
||||||
fun progress_callback (duration, progress)
|
|
||||||
{
|
|
||||||
if (progress > 0.01 && Plymouth.GetMode() != "shutdown" && Plymouth.GetMode() != "reboot" && Plymouth.GetMode() != "suspend")
|
|
||||||
{
|
|
||||||
if (!global.progress_visible)
|
|
||||||
{
|
|
||||||
progress_box.sprite.SetOpacity(1);
|
|
||||||
progress_bar.sprite.SetOpacity(1);
|
|
||||||
global.progress_visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
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, progress_bar.original_image.GetHeight());
|
|
||||||
progress_bar.sprite.SetImage (progress_bar.image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Hide progress bar when progress is 0
|
|
||||||
if (global.progress_visible)
|
|
||||||
{
|
|
||||||
progress_box.sprite.SetOpacity(0);
|
|
||||||
progress_bar.sprite.SetOpacity(0);
|
|
||||||
global.progress_visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetBootProgressFunction(progress_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Quit --------------------------------
|
|
||||||
|
|
||||||
fun quit_callback ()
|
|
||||||
{
|
|
||||||
logo.sprite.SetOpacity (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetQuitFunction(quit_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Message --------------------------------
|
|
||||||
|
|
||||||
message_sprite = Sprite();
|
|
||||||
message_sprite.SetPosition(10, 10, 10000);
|
|
||||||
|
|
||||||
fun display_message_callback (text)
|
|
||||||
{
|
|
||||||
my_image = Image.Text(text, 1, 1, 1);
|
|
||||||
message_sprite.SetImage(my_image);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hide_message_callback (text)
|
|
||||||
{
|
|
||||||
message_sprite.SetOpacity(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetDisplayMessageFunction (display_message_callback);
|
|
||||||
Plymouth.SetHideMessageFunction (hide_message_callback);
|
|
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 1.4 KiB |
@ -1,11 +0,0 @@
|
|||||||
[Plymouth Theme]
|
|
||||||
Name=Omarchy
|
|
||||||
Description=Script example plugin.
|
|
||||||
ModuleName=script
|
|
||||||
|
|
||||||
[script]
|
|
||||||
ImageDir=/usr/share/plymouth/themes/omarchy
|
|
||||||
ScriptFile=/usr/share/plymouth/themes/omarchy/omarchy.script
|
|
||||||
ConsoleLogBackgroundColor=0x2d353b
|
|
||||||
|
|
||||||
|
|
@ -1,237 +0,0 @@
|
|||||||
# Omarchy Plymouth Theme Script
|
|
||||||
|
|
||||||
Window.SetBackgroundTopColor(0.176, 0.208, 0.231);
|
|
||||||
Window.SetBackgroundBottomColor(0.176, 0.208, 0.231);
|
|
||||||
|
|
||||||
logo.image = Image("logo.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);
|
|
||||||
logo.sprite.SetOpacity (1);
|
|
||||||
|
|
||||||
fun refresh_callback ()
|
|
||||||
{
|
|
||||||
# Always animate spinner - it will be invisible when not needed
|
|
||||||
if (global.spinner_sprite)
|
|
||||||
{
|
|
||||||
global.spinner_frame++;
|
|
||||||
frame_index = Math.Int(global.spinner_frame / 3) % global.spinner_frame_count;
|
|
||||||
global.spinner_sprite.SetImage(global.spinner_images[frame_index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetRefreshFunction (refresh_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Dialogue --------------------------------
|
|
||||||
|
|
||||||
status = "normal";
|
|
||||||
|
|
||||||
fun dialog_setup()
|
|
||||||
{
|
|
||||||
local.lock;
|
|
||||||
local.entry;
|
|
||||||
|
|
||||||
lock.image = Image("lock.png");
|
|
||||||
entry.image = Image("entry.png");
|
|
||||||
|
|
||||||
entry.sprite = Sprite(entry.image);
|
|
||||||
entry.x = Window.GetX() + Window.GetWidth()/2 - entry.image.GetWidth() / 2;
|
|
||||||
entry.y = logo.sprite.GetY() + logo.image.GetHeight() + 40;
|
|
||||||
entry.z = 10001;
|
|
||||||
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
|
|
||||||
|
|
||||||
lock.sprite = Sprite(lock.image);
|
|
||||||
lock.x = entry.x - lock.image.GetWidth() - 10;
|
|
||||||
lock.y = logo.sprite.GetY() + logo.image.GetHeight() + 40 + entry.image.GetHeight()/2 - lock.image.GetHeight()/2;
|
|
||||||
lock.z = 10001;
|
|
||||||
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
|
|
||||||
|
|
||||||
global.dialog.lock = lock;
|
|
||||||
global.dialog.entry = entry;
|
|
||||||
global.dialog.bullet_image = Image("bullet.png");
|
|
||||||
dialog_opacity (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun dialog_opacity(opacity)
|
|
||||||
{
|
|
||||||
global.dialog.lock.sprite.SetOpacity (opacity);
|
|
||||||
global.dialog.entry.sprite.SetOpacity (opacity);
|
|
||||||
for (index = 0; global.dialog.bullet[index]; index++)
|
|
||||||
{
|
|
||||||
global.dialog.bullet[index].sprite.SetOpacity(opacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun display_normal_callback ()
|
|
||||||
{
|
|
||||||
global.status = "normal";
|
|
||||||
if (global.dialog)
|
|
||||||
dialog_opacity (0);
|
|
||||||
spinner_show(); # Show spinner when no password dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
fun display_password_callback (prompt, bullets)
|
|
||||||
{
|
|
||||||
global.status = "password";
|
|
||||||
|
|
||||||
# Always hide spinner when showing password dialog
|
|
||||||
spinner_hide();
|
|
||||||
|
|
||||||
# Setup dialog if it doesn't exist
|
|
||||||
if (!global.dialog)
|
|
||||||
dialog_setup();
|
|
||||||
else
|
|
||||||
dialog_opacity(1);
|
|
||||||
|
|
||||||
# Clear all bullets first (user might hit backspace)
|
|
||||||
for (index = 0; global.dialog.bullet[index]; index++)
|
|
||||||
{
|
|
||||||
global.dialog.bullet[index].sprite.SetOpacity(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create and show bullets for current password
|
|
||||||
for (index = 0; index < bullets; index++)
|
|
||||||
{
|
|
||||||
if (!global.dialog.bullet[index])
|
|
||||||
{
|
|
||||||
global.dialog.bullet[index].sprite = Sprite(global.dialog.bullet_image);
|
|
||||||
global.dialog.bullet[index].x = global.dialog.entry.x + 10 + index * (global.dialog.bullet_image.GetWidth() + 5);
|
|
||||||
global.dialog.bullet[index].y = global.dialog.entry.y + global.dialog.entry.image.GetHeight() / 2 - global.dialog.bullet_image.GetHeight() / 2;
|
|
||||||
global.dialog.bullet[index].z = global.dialog.entry.z + 1;
|
|
||||||
global.dialog.bullet[index].sprite.SetPosition(global.dialog.bullet[index].x, global.dialog.bullet[index].y, global.dialog.bullet[index].z);
|
|
||||||
}
|
|
||||||
global.dialog.bullet[index].sprite.SetOpacity(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetDisplayNormalFunction(display_normal_callback);
|
|
||||||
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Spinner --------------------------------
|
|
||||||
|
|
||||||
global.spinner_sprite = NULL;
|
|
||||||
global.spinner_frame = 0;
|
|
||||||
global.spinner_frame_count = 30;
|
|
||||||
global.spinner_visible = false;
|
|
||||||
global.spinner_images = [];
|
|
||||||
|
|
||||||
fun spinner_setup()
|
|
||||||
{
|
|
||||||
if (!global.spinner_sprite)
|
|
||||||
{
|
|
||||||
# Load all throbber frames
|
|
||||||
for (i = 1; i <= global.spinner_frame_count; i++)
|
|
||||||
{
|
|
||||||
if (i < 10)
|
|
||||||
filename = "throbber-000" + i + ".png";
|
|
||||||
else
|
|
||||||
filename = "throbber-00" + i + ".png";
|
|
||||||
global.spinner_images[i-1] = Image(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create spinner sprite
|
|
||||||
global.spinner_sprite = Sprite(global.spinner_images[0]);
|
|
||||||
global.spinner_x = Window.GetX() + Window.GetWidth() / 2 - global.spinner_images[0].GetWidth() / 2;
|
|
||||||
global.spinner_y = Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2 + logo.image.GetHeight() + 40;
|
|
||||||
global.spinner_sprite.SetPosition(global.spinner_x, global.spinner_y, 10002);
|
|
||||||
global.spinner_sprite.SetOpacity(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun spinner_show()
|
|
||||||
{
|
|
||||||
if (global.spinner_sprite)
|
|
||||||
{
|
|
||||||
global.spinner_sprite.SetOpacity(1);
|
|
||||||
global.spinner_visible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun spinner_hide()
|
|
||||||
{
|
|
||||||
if (global.spinner_sprite)
|
|
||||||
{
|
|
||||||
global.spinner_sprite.SetOpacity(0);
|
|
||||||
global.spinner_visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Initialize spinner
|
|
||||||
spinner_setup();
|
|
||||||
#----------------------------------------- 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.75 - progress_box.image.GetHeight() / 2;
|
|
||||||
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
|
|
||||||
progress_box.sprite.SetOpacity(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() / 2 * 1.5 - 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);
|
|
||||||
progress_bar.sprite.SetOpacity(0);
|
|
||||||
|
|
||||||
global.progress_visible = false;
|
|
||||||
fun progress_callback (duration, progress)
|
|
||||||
{
|
|
||||||
if (progress > 0.01 && Plymouth.GetMode() != "shutdown" && Plymouth.GetMode() != "reboot" && Plymouth.GetMode() != "suspend")
|
|
||||||
{
|
|
||||||
if (!global.progress_visible)
|
|
||||||
{
|
|
||||||
progress_box.sprite.SetOpacity(1);
|
|
||||||
progress_bar.sprite.SetOpacity(1);
|
|
||||||
global.progress_visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
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, progress_bar.original_image.GetHeight());
|
|
||||||
progress_bar.sprite.SetImage (progress_bar.image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Hide progress bar when progress is 0
|
|
||||||
if (global.progress_visible)
|
|
||||||
{
|
|
||||||
progress_box.sprite.SetOpacity(0);
|
|
||||||
progress_bar.sprite.SetOpacity(0);
|
|
||||||
global.progress_visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetBootProgressFunction(progress_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Quit --------------------------------
|
|
||||||
|
|
||||||
fun quit_callback ()
|
|
||||||
{
|
|
||||||
logo.sprite.SetOpacity (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetQuitFunction(quit_callback);
|
|
||||||
|
|
||||||
#----------------------------------------- Message --------------------------------
|
|
||||||
|
|
||||||
message_sprite = Sprite();
|
|
||||||
message_sprite.SetPosition(10, 10, 10000);
|
|
||||||
|
|
||||||
fun display_message_callback (text)
|
|
||||||
{
|
|
||||||
my_image = Image.Text(text, 1, 1, 1);
|
|
||||||
message_sprite.SetImage(my_image);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hide_message_callback (text)
|
|
||||||
{
|
|
||||||
message_sprite.SetOpacity(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Plymouth.SetDisplayMessageFunction (display_message_callback);
|
|
||||||
Plymouth.SetHideMessageFunction (hide_message_callback);
|
|
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |