-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolus-glow.script
More file actions
137 lines (105 loc) · 4.1 KB
/
Copy pathsolus-glow.script
File metadata and controls
137 lines (105 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Solus Charge Theme - Full Color Logo Fill
# Dark Background (#0d0f12)
Window.SetBackgroundTopColor(0.05, 0.06, 0.07);
Window.SetBackgroundBottomColor(0.05, 0.06, 0.07);
screen_width = Window.GetWidth();
screen_height = Window.GetHeight();
mode = Plymouth.GetMode();
# --- 1. Glow Layer (Behind Logo) ---
glow_image = Image("solus_glow.png");
glow_sprite = Sprite(glow_image);
glow_x = screen_width / 2 - glow_image.GetWidth() / 2;
glow_y = screen_height / 2 - glow_image.GetHeight() / 2 - 20;
glow_sprite.SetX(glow_x);
glow_sprite.SetY(glow_y);
glow_sprite.SetOpacity(0.0);
# --- 2. Dual-Layer Logo Setup ---
logo_color_image = Image("solus_logo_color.png").Scale(96, 96);
logo_dim_image = Image("solus_logo_dim.png").Scale(96, 96);
logo_width = logo_color_image.GetWidth();
logo_height = logo_color_image.GetHeight();
logo_x = screen_width / 2 - logo_width / 2;
logo_y = screen_height / 2 - logo_height / 2 - 20;
# Layer A: Muted Grayscale Base Logo
logo_bg_sprite = Sprite(logo_dim_image);
logo_bg_sprite.SetX(logo_x);
logo_bg_sprite.SetY(logo_y);
logo_bg_sprite.SetOpacity(0.6);
# Layer B: Full-Color Cropped Logo Fill
logo_fill_sprite = Sprite();
logo_fill_sprite.SetX(logo_x);
logo_fill_sprite.SetY(logo_y);
logo_fill_sprite.SetOpacity(1.0);
# --- 3. Progress Bar Setup ---
bar_bg_image = Image("bar_bg.png");
bar_fill_image = Image("bar_fill.png");
bar_width = bar_bg_image.GetWidth();
bar_height = bar_bg_image.GetHeight();
bar_x = screen_width / 2 - bar_width / 2;
bar_y = logo_y + logo_height + 32;
bar_bg_sprite = Sprite(bar_bg_image);
bar_bg_sprite.SetX(bar_x);
bar_bg_sprite.SetY(bar_y);
bar_fill_sprite = Sprite();
bar_fill_sprite.SetX(bar_x);
bar_fill_sprite.SetY(bar_y);
# Hide progress elements on shutdown/reboot
if (mode != "boot") {
bar_bg_sprite.SetOpacity(0);
bar_fill_sprite.SetOpacity(0);
logo_bg_sprite.SetOpacity(0);
logo_fill_sprite.SetImage(logo_color_image);
logo_fill_sprite.SetY(logo_y);
}
# --- State Variables ---
current_progress = 0.0;
is_fully_loaded = 0;
throb_counter = 0.0;
# --- Main Refresh Loop ---
fun refresh_callback () {
if (mode == "boot") {
if (current_progress < 1.0) {
current_progress += 0.015;
if (current_progress >= 1.0) {
current_progress = 1.0;
is_fully_loaded = 1;
}
}
# 1. Update Progress Pill Fill
fill_bar_width = Math.Max(1, Math.Min(bar_width, bar_width * current_progress));
scaled_bar_fill = bar_fill_image.Scale(fill_bar_width, bar_height);
bar_fill_sprite.SetImage(scaled_bar_fill);
# 2. Update Bottom-to-Top Color Logo Crop
if (!is_fully_loaded) {
fill_logo_height = Math.Max(1, Math.Min(logo_height, logo_height * current_progress));
crop_y = logo_height - fill_logo_height;
# Crop colored logo and place it aligned over the dim background
cropped_logo = logo_color_image.Crop(0, crop_y, logo_width, fill_logo_height);
logo_fill_sprite.SetImage(cropped_logo);
logo_fill_sprite.SetY(logo_y + crop_y);
glow_sprite.SetOpacity(current_progress * 0.25);
}
}
# 3. Throbbing Glow Culmination
if (is_fully_loaded || mode != "boot") {
throb_counter += 0.08;
# Ensure complete color logo is set
logo_fill_sprite.SetImage(logo_color_image);
logo_fill_sprite.SetY(logo_y);
# Pulse opacity for color logo and background halo
logo_opacity = 0.9 + (0.1 * Math.Sin(throb_counter));
logo_fill_sprite.SetOpacity(logo_opacity);
glow_opacity = 0.625 + (0.375 * Math.Sin(throb_counter));
glow_sprite.SetOpacity(glow_opacity);
}
}
Plymouth.SetRefreshFunction(refresh_callback);
# --- LUKS / Password Prompt Handling ---
message_sprite = Sprite();
message_sprite.SetPosition(screen_width * 0.1, screen_height * 0.85, 10000);
fun DisplayQuestion (prompt, entry) {
message_image = Image.Text(prompt, 1.0, 1.0, 1.0);
message_sprite.SetImage(message_image);
}
Plymouth.SetDisplayPasswordFunction(DisplayQuestion);
Plymouth.SetDisplayQuestionFunction(DisplayQuestion);