-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblazinlock
653 lines (600 loc) · 14.1 KB
/
blazinlock
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
#!/bin/bash
function help {
if [ -s /usr/bin/figlet ]; then
figlet Help
else
echo "Help"
fi
echo "Usage: blazinlock [OPTIONS] [OPTION_VALUE]"
echo "Eg -"
echo " blazinlock -hw"
echo " blazinlock -hs"
echo " blazinlock -i \$HOME/Pictures/background.png"
echo " blazinlock -s"
echo ""
echo "============================================================="
echo "OPTIONS"
echo " -hs = Hyprdots (waybar) Integration Screenshot"
echo " -hw = Hyprdots (waybar) Integration Wallpaper"
echo " -es = End 4 Dots (ags) Integration Screenshot"
echo " -ew = End 4 Dots (ags) Integration Wallpaper"
echo " -s = Screenshot Type Hyprlock"
echo " -i = User Image Type Hyprlock"
}
if [ "$#" -eq 0 ]; then
help
exit 1
fi
# Define paths
HYPRLOCK_DIR="$HOME/.config/hypr/"
WAYBAR_THEME_CSS="$HOME/.config/waybar/theme.css"
AGS_THEME_CSS="$HOME/.local/state/ags/scss/_material.scss"
HyperdotIntegration() {
local TYPE=$1
if [ $TYPE -eq 0 ]; then
BACKGROUND_IMAGE=screenshot
else
BACKGROUND_IMAGE=$(swww query | grep -oP 'currently displaying: image: \K.*')
if [ -z "$BACKGROUND_IMAGE" ] || [ ! -f "$BACKGROUND_IMAGE" ]; then
echo "No valid background image found from swww."
exit 1
fi
fi
# Extract Theme Colors
if [ "$2" == "end4" ]; then
# AGS INTEGRATION (End 4 Dots)
FG_COLOR=$(grep "\$primary:" "$AGS_THEME_CSS" | awk '{print $2}' | tr -d ';')
BG_COLOR=$(grep "\$background:" "$AGS_THEME_CSS" | awk '{print $2}' | tr -d ';')
TEXT_COLOR=$(grep "\$onBackground:" "$AGS_THEME_CSS" | awk '{print $2}' | tr -d ';')
else
# WAYBAR INTEGRATION
FG_COLOR=$(grep 'main-fg' "$WAYBAR_THEME_CSS" | awk '{print $3}' | tr -d ';')
BG_COLOR=$(grep 'main-bg' "$WAYBAR_THEME_CSS" | awk '{print $3}' | tr -d ';')
TEXT_COLOR=$(grep 'wb-act-bg' "$WAYBAR_THEME_CSS" | awk '{print $3}' | tr -d ';')
fi
# Check if colors were extracted successfully
if [ -z "$FG_COLOR" ] || [ -z "$BG_COLOR" ] || [ -z "$TEXT_COLOR" ]; then
echo "Error: Failed to extract colors from $THEME_CSS. Please check the file."
exit 1
fi
BG_COLOR=${BG_COLOR: -6}
FG_COLOR=${FG_COLOR: -6}
TEXT_COLOR=${TEXT_COLOR: -6}
cd $HYPRLOCK_DIR
chmod u+w "hyprlock.conf"
# Create the hyprlock config
cat << EOF > "hyprlock.conf"
general {
grace = 1
ignore_empty_input = true
text_trim = false
disable_loading_bar = true
}
background {
color = rgba(${BG_COLOR}FF)
path = $BACKGROUND_IMAGE
blur_size = 2
blur_passes = 3
zindex = -1
}
# INPUT FIELD
input-field {
monitor =
size = 230, 50
outline_thickness = 4
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true
outer_color = rgba(${TEXT_COLOR}99)
inner_color = rgba(${BG_COLOR}FF)
font_color = rgba(${TEXT_COLOR}FF)
fade_on_empty = false
font_family = JetBrainsMono Nerd Font Mono
placeholder_text = <i><span foreground="##${TEXT_COLOR}">Input Password...</span></i>
hide_input = false
position = 0, -220
halign = center
valign = center
zindex = 10
}
# CLOCK/TIME
label {
monitor =
text = \$TIME
color = rgba(255, 255, 255, 1)
shadow_color = rgba(${BG_COLOR}AA)
font_size = 90
shadow_passes = 3
shadow_boost = 0.5
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 0, -100
halign = center
valign = top
zindex = 3
}
# Big Rectangle
shape {
monitor =
size = 100%, 60
color = rgba(${BG_COLOR}FF)
halign = center
valign = bottom
zindex = 0
}
# Small Rectangle for Battery
shape {
monitor =
size = 70, 32
rounding = 12
color = rgba(${FG_COLOR}FF)
halign = right
valign = bottom
position = -14, 14
zindex = 1
}
# Battery Status
label {
monitor =
text = cmd[update:5000] ~/.config/hypr/hyprlock/blazinscripts.sh -bat
shadow_passes = 1
shadow_boost = 0.5
color = rgba(${BG_COLOR}FF)
shadow_color = rgba(${BG_COLOR}AA)
font_size = 14
font_family = Maple Mono
position = -21, -8
halign = right
valign = bottom
zindex = 2
}
# Small Rectangle for Session
shape {
monitor =
size = 150, 32
rounding = 10
color = rgba(${FG_COLOR}FF)
halign = center
valign = bottom
position = 0, 14
zindex = 1
}
# Current Session Status
label {
monitor =
text = cmd[update:24000000] echo "Session : \$XDG_SESSION_DESKTOP"
# shadow_passes = 1
# shadow_boost = 0.5
color = rgba(${BG_COLOR}FF)
shadow_color = rgba(${BG_COLOR}AA)
font_size = 12
font_family = Jost Medium
position = 0, -5
halign = center
valign = bottom
zindex = 2
}
# PFP Image
image {
monitor =
path = \$HOME/.config/hypr/hyprlock/pfp.jpg
size = 100
rounding = -1
border_size = 3
border_color = rgba(${TEXT_COLOR}FF)
position = 10, 10
halign = left
valign = bottom
zindex = 3
}
# Username
label {
monitor =
text = \$USER
shadow_passes = 1
shadow_boost = 0.5
color = rgba(${FG_COLOR}FF)
shadow_color = rgba(${FG_COLOR}AA)
font_size = 14
font_family = Jost Bold Italic
position = 120, 28
halign = left
valign = bottom
zindex = 2
}
# Hostname
label {
monitor =
text = cmd[update:24000000] echo "@\$(uname -n)"
shadow_passes = 1
shadow_boost = 0.5
color = rgba(${TEXT_COLOR}BB)
shadow_color = rgba(${TEXT_COLOR}AA)
font_size = 14
font_family = Jost Bold Italic
position = 120, -20
halign = left
valign = bottom
zindex = 2
}
# Lock Icon
label {
monitor =
text =
shadow_passes = 1
shadow_boost = 0.5
color = rgba(${TEXT_COLOR}FF)
shadow_color = rgba(${TEXT_COLOR}AA)
font_size = 20
font_family = Font Awesome 6 Free Solid
position = 0, -65
halign = center
valign = top
zindex = 2
}
# PLAYER IMAGE
image {
monitor =
path = \$HOME/.config/hypr/hyprlock/music.webp
size = 60 # lesser side if not 1:1 ratio
rounding = 5 # negative values mean circle
border_size = 0
rotate = 0 # degrees, counter-clockwise
reload_time = 2
reload_cmd = ~/.config/hypr/hyprlock/blazinscripts.sh -music --arturl
position = -106, 0
halign = center
valign = center
zindex = 1
}
# PLAYER BOX
shape {
monitor =
color = rgba(${BG_COLOR}BB)
size = 300, 84
rounding = 10 # negative values mean circle
position = 0, 0
halign = center
valign = center
zindex = 0
}
# PLAYER TITTLE
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --title)"
color = rgba(${TEXT_COLOR}FF)
font_size = 14
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 50, -12
halign = center
valign = center
zindex = 1
}
# PLAYER STATUS
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --status)"
color = rgba(${TEXT_COLOR}FF)
font_size = 18
font_family = JetBrains Mono Nerd Font Mono Bold
position = -50, -15
halign = center
valign = center
zindex = 1
}
# PLAYER SOURCE
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --source)"
color = rgba(${FG_COLOR}99)
font_size = 10
font_family = JetBrains Mono Nerd Font Mono
position = -20, 18
halign = center
valign = center
zindex = 1
}
# PLAYER Artist
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --artist)"
color = rgba(${FG_COLOR}BB)
font_size = 12
font_family = JetBrains Mono Nerd Font Mono
position = 10, -35
halign = center
valign = center
zindex = 1
}
EOF
chmod u-w "hyprlock.conf"
echo "Generated Hyprland/End4 Config"
}
Standalone() {
local TYPE=$1
if [ $TYPE -eq 0 ]; then
BACKGROUND_IMAGE=screenshot
else
BACKGROUND_IMAGE="$2"
echo $2
if [ -z "$BACKGROUND_IMAGE" ] || [ ! -f "$BACKGROUND_IMAGE" ]; then
echo "No valid path provided for background image."
exit 1
elif [[ "$BACKGROUND_IMAGE" =~ ^.*\.{gif}$ ]]; then
echo "GIFs are not supported ATM"
exit 1
fi
fi
cd $HYPRLOCK_DIR
chmod u+w "hyprlock.conf"
# Create the hyprlock config
cat << EOF > "hyprlock.conf"
general {
grace = 1
ignore_empty_input = true
text_trim = false
disable_loading_bar = true
}
background {
color = rgba(222222FF)
path = $BACKGROUND_IMAGE
blur_size = 2
blur_passes = 3
zindex = -1
}
# INPUT FIELD
input-field {
monitor =
size = 230, 50
outline_thickness = 4
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true
outer_color = rgba(22222299)
inner_color = rgba(255, 255, 255, 0.8)
font_color = rgb(34, 34, 34)
fade_on_empty = false
font_family = JetBrainsMono Nerd Font Mono
placeholder_text = <i><span foreground="##222222">Input Password...</span></i>
hide_input = false
position = 0, -220
halign = center
valign = center
zindex = 10
}
# CLOCK/TIME
label {
monitor =
text = \$TIME
color = rgba(255, 255, 255, 1)
font_size = 90
shadow_passes = 3
shadow_boost = 0.5
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 0, -100
halign = center
valign = top
zindex = 3
}
# Big Rectangle
shape {
monitor =
size = 100%, 60
color = rgba(222222AA)
halign = center
valign = bottom
zindex = 0
}
# Small Rectangle for Battery
shape {
monitor =
size = 70, 32
rounding = 12
color = rgba(FFFFFFFF)
halign = right
valign = bottom
position = -14, 14
zindex = 1
}
# Battery Status
label {
monitor =
text = cmd[update:5000] ~/.config/hypr/hyprlock/blazinscripts.sh -bat
shadow_passes = 1
shadow_boost = 0.5
color = rgba(222222FF)
font_size = 14
font_family = Maple Mono
position = -21, -8
halign = right
valign = bottom
zindex = 2
}
# Small Rectangle for Session
shape {
monitor =
size = 150, 32
rounding = 10
color = rgba(FFFFFFFF)
halign = center
valign = bottom
position = 0, 14
zindex = 1
}
# Current Session Status
label {
monitor =
text = cmd[update:24000000] echo "Session : \$XDG_SESSION_DESKTOP"
# shadow_passes = 1
# shadow_boost = 0.5
color = rgba(222222FF)
font_size = 12
font_family = Jost Medium
position = 0, -5
halign = center
valign = bottom
zindex = 2
}
# PFP Image
image {
monitor =
path = \$HOME/.config/hypr/hyprlock/pfp.jpg
size = 100
rounding = -1
border_size = 3
border_color = rgba(FFFFFFFF)
position = 10, 10
halign = left
valign = bottom
zindex = 3
}
# Username
label {
monitor =
text = \$USER
shadow_passes = 1
shadow_boost = 0.5
color = rgba(FFFFFFFF)
font_size = 14
font_family = Jost Bold Italic
position = 120, 28
halign = left
valign = bottom
zindex = 2
}
# Hostname
label {
monitor =
text = cmd[update:24000000] echo "@\$(uname -n)"
shadow_passes = 1
shadow_boost = 0.5
color = rgba(FFFFFFBB)
font_size = 14
font_family = Jost Bold Italic
position = 120, -20
halign = left
valign = bottom
zindex = 2
}
# Lock Icon
label {
monitor =
text =
shadow_passes = 1
shadow_boost = 0.5
color = rgba(255, 255, 255, 1)
font_size = 20
font_family = Font Awesome 6 Free Solid
position = 0, -65
halign = center
valign = top
zindex = 2
}
# PLAYER IMAGE
image {
monitor =
path = \$HOME/.config/hypr/hyprlock/music.webp
size = 60 # lesser side if not 1:1 ratio
rounding = 5 # negative values mean circle
border_size = 0
rotate = 0 # degrees, counter-clockwise
reload_time = 2
reload_cmd = ~/.config/hypr/hyprlock/blazinscripts.sh -music --arturl
position = -106, 0
halign = center
valign = center
zindex = 1
}
# PLAYER BOX
shape {
monitor =
color = rgba(222222BB)
size = 300, 84
rounding = 10 # negative values mean circle
position = 0, 0
halign = center
valign = center
zindex = 0
}
# PLAYER TITTLE
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --title)"
color = rgba(255, 255, 255, 0.8)
font_size = 14
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 50, -12
halign = center
valign = center
zindex = 1
}
# PLAYER STATUS
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --status)"
color = rgba(255, 255, 255, 1)
font_size = 18
font_family = JetBrains Mono Nerd Font Mono Bold
position = -50, -15
halign = center
valign = center
zindex = 1
}
# PLAYER SOURCE
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --source)"
color = rgba(255, 255, 255, 0.6)
font_size = 10
font_family = JetBrains Mono Nerd Font Mono
position = -20, 16
halign = center
valign = center
zindex = 1
}
# PLAYER Artist
label {
monitor =
text = cmd[update:1000] echo "\$(~/.config/hypr/hyprlock/blazinscripts.sh -music --artist)"
color = rgba(255, 255, 255, 0.8)
font_size = 12
font_family = JetBrains Mono Nerd Font Mono
position = 10, -35
halign = center
valign = center
zindex = 1
}
EOF
chmod u-w "hyprlock.conf"
echo "Generated Hyprland Config"
}
case "$1" in
-s)
echo "Screenshot Lock"
Standalone 0
;;
-i)
echo "Custom Image Lock"
Standalone 1 "$2"
;;
-hs)
echo "Hyprlock Screenshot"
HyperdotIntegration 0
;;
-hw)
echo "Hyprlock Wallpaper"
HyperdotIntegration 1
;;
-es)
echo "End 4 Screenshot"
HyperdotIntegration 0 end4
;;
-ew)
echo "End 4 Wallpaper"
HyperdotIntegration 1 end4
;;
*)
help
exit 1
;;
esac
hyprlock