-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslicksddm-customize
More file actions
executable file
·1602 lines (1462 loc) · 52.9 KB
/
Copy pathslicksddm-customize
File metadata and controls
executable file
·1602 lines (1462 loc) · 52.9 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
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
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#
# slicksddm-customize - Interactive SDDM theme customization tool
#
# Copyright (C) 2026 Ubuntu Budgie Developers
# Licensed under GPLv3
#
# This script provides an interactive interface to customize the slickSDDM theme
# configuration without manually editing theme.conf files.
#
set -e
# Script metadata for help2man
SCRIPT_NAME="slicksddm-customize"
VERSION="1.0.0"
DESCRIPTION="Interactive customization tool for slickSDDM theme"
# Color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m' # No Color
# Default paths
DEFAULT_THEME_DIR="/usr/share/sddm/themes"
THEME_NAME="${THEME_NAME:-ubuntu-budgie-login}"
THEME_DIR="${DEFAULT_THEME_DIR}/${THEME_NAME}"
CONFIG_FILE="${THEME_DIR}/theme.conf"
BACKUP_DIR="${HOME}/.config/sddm-theme-backups"
# Flags
INTERACTIVE=0
DRY_RUN=0
VERBOSE=0
NO_BACKUP=0
#######################################
# Print script version
#######################################
version() {
cat << EOF
$SCRIPT_NAME $VERSION
Copyright (C) 2026 Ubuntu Budgie Developers
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
}
#######################################
# Print help message
#######################################
help() {
cat << EOF
Usage: $SCRIPT_NAME [OPTION]...
Interactive customization tool for the slickSDDM theme.
Modify theme.conf settings without manual editing.
Options:
-i, --interactive Launch interactive configuration wizard
-s, --set KEY=VALUE Set a single configuration value
-g, --get KEY Get current value for a key
-l, --list List all current configuration settings
-r, --reset Reset to default configuration
--reset-section SEC Reset a specific section to defaults
-b, --backup Create backup of current configuration
--restore FILE Restore configuration from backup
-t, --theme NAME Specify theme name (default: ubuntu-budgie-login)
-d, --theme-dir DIR Specify theme directory
--dry-run Show what would be changed without applying
--no-backup Don't create automatic backup
-v, --verbose Enable verbose output
-h, --help Display this help and exit
-V, --version Display version information and exit
Interactive Mode:
The interactive mode (-i) provides a menu-driven interface to customize:
- General settings (scale, animations)
- Lock screen appearance
- Login screen layout
- Colors and fonts
- Menu buttons and popups
- Virtual keyboard
- Tooltips
Examples:
$SCRIPT_NAME -i
Launch interactive configuration wizard
$SCRIPT_NAME --set "LoginScreen.LoginArea.Avatar/active-border-color=#ff0000"
Set avatar border color to red
$SCRIPT_NAME --set "General/use-accounts-service-backgrounds=true"
Enable per-user wallpapers from AccountsService
$SCRIPT_NAME --get "LockScreen/background"
Display current lock screen background
$SCRIPT_NAME --list | grep color
List all color-related settings
$SCRIPT_NAME --backup
Create timestamped backup of current configuration
$SCRIPT_NAME --reset-section "LockScreen.Clock"
Reset clock settings to defaults
$SCRIPT_NAME --theme custom-theme --dry-run --set "General/scale=1.5"
Preview scale change for a different theme
Configuration Keys:
Keys follow the format: Section/key or Section.Subsection/key
Examples:
General/scale
General/use-accounts-service-backgrounds
LockScreen/background
LoginScreen.LoginArea.Avatar/shape
LoginScreen.MenuArea.Power/display
Use --list to see all available keys.
Files:
${CONFIG_FILE}
Main theme configuration file
${BACKUP_DIR}/
Automatic backup storage location
/usr/share/doc/sddm-themes/CUSTOMIZATION.md
Complete customization reference
Report bugs to: https://github.com/ubuntubudgie/slickSDDM/issues
Project home: https://ubuntubudgie.org
EOF
}
#######################################
# Print colored message
# Arguments:
# $1 - Color code
# $2 - Message
#######################################
print_color() {
echo -e "${1}${2}${NC}"
}
#######################################
# Print error message and exit
# Arguments:
# $1 - Error message
# $2 - Exit code (default: 1)
#######################################
error_exit() {
print_color "$RED" "Error: $1" >&2
exit "${2:-1}"
}
#######################################
# Print warning message
# Arguments:
# $1 - Warning message
#######################################
warning() {
print_color "$YELLOW" "Warning: $1" >&2
}
#######################################
# Print info message
# Arguments:
# $1 - Info message
#######################################
info() {
print_color "$CYAN" "$1"
}
#######################################
# Print success message
# Arguments:
# $1 - Success message
#######################################
success() {
print_color "$GREEN" "✓ $1"
}
#######################################
# Print verbose message if verbose mode enabled
# Arguments:
# $1 - Message
#######################################
verbose() {
if [[ $VERBOSE -eq 1 ]]; then
print_color "$BLUE" "[VERBOSE] $1"
fi
}
#######################################
# Check if running with sufficient privileges
#######################################
check_privileges() {
if [[ $EUID -ne 0 ]] && [[ $DRY_RUN -eq 0 ]]; then
error_exit "This script must be run with sudo privileges to modify system files.
Try: sudo $SCRIPT_NAME $*" 2
fi
}
#######################################
# Check if theme directory exists
#######################################
check_theme_exists() {
if [[ ! -d "$THEME_DIR" ]]; then
error_exit "Theme directory not found: $THEME_DIR
Please install the theme or specify correct path with --theme-dir" 3
fi
if [[ ! -f "$CONFIG_FILE" ]]; then
error_exit "Configuration file not found: $CONFIG_FILE
Theme installation may be incomplete" 3
fi
}
#######################################
# Create backup of configuration
# Returns:
# 0 on success, 1 on failure
#######################################
create_backup() {
local timestamp=$(date +%Y%m%d_%H%M%S)
local backup_file="${BACKUP_DIR}/${THEME_NAME}_${timestamp}.conf"
if [[ $NO_BACKUP -eq 1 ]]; then
verbose "Backup skipped (--no-backup flag)"
return 0
fi
mkdir -p "$BACKUP_DIR"
if cp "$CONFIG_FILE" "$backup_file" 2>/dev/null; then
success "Backup created: $backup_file"
return 0
else
warning "Failed to create backup"
return 1
fi
}
#######################################
# Parse INI-style config file
# Arguments:
# $1 - Section name (with subsections: "Section.Subsection")
# $2 - Key name
# Outputs:
# Current value of the key
# Returns:
# 0 if found, 1 if not found
#######################################
get_config_value() {
local section="$1"
local key="$2"
local in_section=0
local value=""
# Convert section format: "Section.Subsection" -> "[Section.Subsection]"
local section_header="[${section}]"
while IFS= read -r line; do
# Trim whitespace
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
# Skip empty lines and comments
[[ -z "$line" || "$line" =~ ^# || "$line" =~ "^;" ]] && continue
# Check for section header
if [[ "$line" =~ ^\[.*\]$ ]]; then
if [[ "$line" == "$section_header" ]]; then
in_section=1
else
in_section=0
fi
continue
fi
# If in correct section, look for key
if [[ $in_section -eq 1 && "$line" =~ ^${key}[[:space:]]*= ]]; then
value=$(echo "$line" | cut -d'=' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
echo "$value"
return 0
fi
done < "$CONFIG_FILE"
return 1
}
#######################################
# Set configuration value
# Arguments:
# $1 - Section name
# $2 - Key name
# $3 - New value
#######################################
set_config_value() {
local section="$1"
local key="$2"
local value="$3"
local section_header="[${section}]"
local temp_file="${CONFIG_FILE}.tmp"
local in_section=0
local key_found=0
verbose "Setting ${section}/${key} = ${value}"
if [[ $DRY_RUN -eq 1 ]]; then
info "[DRY-RUN] Would set ${section}/${key} = ${value}"
return 0
fi
# Read original file and modify
while IFS= read -r line || [[ -n "$line" ]]; do
# Check for section header
if [[ "$line" =~ ^\[.*\]$ ]]; then
if [[ "$line" == "$section_header" ]]; then
in_section=1
else
# If we were in the section and didn't find the key, add it
if [[ $in_section -eq 1 && $key_found -eq 0 ]]; then
echo "${key} = ${value}" >> "$temp_file"
key_found=1
fi
in_section=0
fi
echo "$line" >> "$temp_file"
continue
fi
# If in correct section and found the key, replace it
if [[ $in_section -eq 1 && "$line" =~ ^${key}[[:space:]]*= ]]; then
echo "${key} = ${value}" >> "$temp_file"
key_found=1
else
echo "$line" >> "$temp_file"
fi
done < "$CONFIG_FILE"
# If section exists but key wasn't found, add it at the end of section
if [[ $in_section -eq 1 && $key_found -eq 0 ]]; then
echo "${key} = ${value}" >> "$temp_file"
fi
# If section doesn't exist at all, add it at the end
if [[ $key_found -eq 0 ]]; then
{
echo ""
echo "$section_header"
echo "${key} = ${value}"
} >> "$temp_file"
fi
# Replace original file
mv "$temp_file" "$CONFIG_FILE"
success "Updated ${section}/${key}"
}
#######################################
# List all configuration values
#######################################
list_config() {
local current_section=""
print_color "$BOLD" "Current Theme Configuration"
echo "======================================"
echo "Theme: $THEME_NAME"
echo "Config: $CONFIG_FILE"
echo "======================================"
echo ""
while IFS= read -r line; do
# Trim whitespace
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
# Skip empty lines
[[ -z "$line" ]] && continue
# Check for comments
if [[ "$line" =~ ^# || "$line" =~ "^\;" ]]; then
if [[ $VERBOSE -eq 1 ]]; then
print_color "$BLUE" "$line"
fi
continue
fi
# Section header
if [[ "$line" =~ ^\[.*\]$ ]]; then
current_section=$(echo "$line" | tr -d '[]')
echo ""
print_color "$MAGENTA" "[$current_section]"
continue
fi
# Key-value pair
if [[ "$line" =~ = ]]; then
local key=$(echo "$line" | cut -d'=' -f1 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
local value=$(echo "$line" | cut -d'=' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
printf " %-40s = %s\n" "$key" "$value"
fi
done < "$CONFIG_FILE"
}
#######################################
# Reset configuration to defaults
# Arguments:
# $1 - Optional: specific section to reset
#######################################
reset_config() {
local section="$1"
local example_file="${THEME_DIR}/theme.conf.example"
if [[ ! -f "$example_file" ]]; then
error_exit "Example configuration not found: $example_file
Cannot reset without reference file" 4
fi
if [[ $DRY_RUN -eq 1 ]]; then
if [[ -n "$section" ]]; then
info "[DRY-RUN] Would reset section: $section"
else
info "[DRY-RUN] Would reset entire configuration"
fi
return 0
fi
# Create backup before reset
create_backup
if [[ -z "$section" ]]; then
# Reset entire config
print_color "$YELLOW" "This will reset ALL settings to defaults."
read -p "Are you sure? (yes/no): " confirm
if [[ "$confirm" != "yes" ]]; then
info "Reset cancelled"
return 0
fi
cp "$example_file" "$CONFIG_FILE"
success "Configuration reset to defaults"
else
# Reset specific section
warning "Resetting section: $section"
# Extract section from example file and replace in config
local temp_file="${CONFIG_FILE}.tmp"
local in_target_section=0
local section_header="[${section}]"
# First, remove the old section
while IFS= read -r line; do
if [[ "$line" =~ ^\[.*\]$ ]]; then
if [[ "$line" == "$section_header" ]]; then
in_target_section=1
continue
else
in_target_section=0
fi
fi
if [[ $in_target_section -eq 0 ]]; then
echo "$line" >> "$temp_file"
fi
done < "$CONFIG_FILE"
# Then append the new section from example
in_target_section=0
while IFS= read -r line; do
if [[ "$line" =~ ^\[.*\]$ ]]; then
if [[ "$line" == "$section_header" ]]; then
in_target_section=1
echo "$line" >> "$temp_file"
continue
else
if [[ $in_target_section -eq 1 ]]; then
break
fi
fi
fi
if [[ $in_target_section -eq 1 ]]; then
echo "$line" >> "$temp_file"
fi
done < "$example_file"
mv "$temp_file" "$CONFIG_FILE"
success "Section $section reset to defaults"
fi
}
#######################################
# Restore configuration from backup
# Arguments:
# $1 - Backup file path
#######################################
restore_config() {
local backup_file="$1"
if [[ ! -f "$backup_file" ]]; then
error_exit "Backup file not found: $backup_file" 5
fi
if [[ $DRY_RUN -eq 1 ]]; then
info "[DRY-RUN] Would restore from: $backup_file"
return 0
fi
# Create backup of current config before restoring
create_backup
cp "$backup_file" "$CONFIG_FILE"
success "Configuration restored from: $backup_file"
}
#######################################
# Restart SDDM service
#######################################
restart_sddm() {
if [[ $DRY_RUN -eq 1 ]]; then
info "[DRY-RUN] Would restart SDDM service"
return 0
fi
print_color "$YELLOW" "Restart SDDM to apply changes?"
echo "This will log you out of the current session."
read -p "Restart now? (yes/no): " confirm
if [[ "$confirm" == "yes" ]]; then
info "Restarting SDDM..."
systemctl restart sddm
else
info "Skipped. Restart later with: sudo systemctl restart sddm"
fi
}
#######################################
# Interactive menu - Main
#######################################
interactive_main_menu() {
while true; do
clear
print_color "$BOLD$CYAN" "╔════════════════════════════════════════════╗"
print_color "$BOLD$CYAN" "║ slickSDDM Theme Configuration Wizard ║"
print_color "$BOLD$CYAN" "╚════════════════════════════════════════════╝"
echo ""
echo "Theme: $THEME_NAME"
echo "Config: $CONFIG_FILE"
echo ""
echo "1) General Settings"
echo "2) Lock Screen"
echo "3) Login Screen"
echo "4) Colors & Fonts"
echo "5) Menu Buttons"
echo "6) Virtual Keyboard"
echo "7) Tooltips"
echo ""
echo "8) View Current Configuration"
echo "9) Backup Configuration"
echo "10) Restore from Backup"
echo "11) Reset to Defaults"
echo ""
echo "T) Test Current Theme"
echo "Q) Quit (and restart SDDM)"
echo "X) Exit (without restart)"
echo ""
read -p "Select option: " choice
case $choice in
1) interactive_general_settings ;;
2) interactive_lockscreen ;;
3) interactive_loginscreen ;;
4) interactive_colors_fonts ;;
5) interactive_menu_buttons ;;
6) interactive_virtual_keyboard ;;
7) interactive_tooltips ;;
8) list_config | less -R ;;
9) create_backup; read -p "Press Enter to continue..." ;;
10) interactive_restore_backup ;;
11) interactive_reset ;;
[Tt]) test_theme ;;
[Qq]) restart_sddm; exit 0 ;;
[Xx]) info "Exiting without restart"; exit 0 ;;
*) warning "Invalid option" ; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Test theme in preview mode
#######################################
test_theme() {
clear
print_color "$BOLD" "Test Theme Preview"
echo "══════════════════"
echo ""
print_color "$CYAN" "Launching theme in test mode..."
print_color "$YELLOW" "Close the preview window to return to this menu."
echo ""
if command -v sddm-greeter-qt6 &>/dev/null; then
sddm-greeter-qt6 --test-mode --theme "$THEME_DIR"
elif command -v sddm-greeter &>/dev/null; then
sddm-greeter --test-mode --theme "$THEME_DIR"
else
warning "Could not find sddm-greeter or sddm-greeter-qt6"
info "Try manually: sddm-greeter-qt6 --test-mode --theme $THEME_DIR"
fi
read -p "Press Enter to continue..."
}
#######################################
# Interactive menu - General Settings
#######################################
interactive_general_settings() {
while true; do
clear
print_color "$BOLD" "General Settings"
echo "════════════════"
echo ""
echo "Current values:"
echo " Scale: $(get_config_value "General" "scale")"
echo " Animations: $(get_config_value "General" "enable-animations")"
echo " Background Fill Mode: $(get_config_value "General" "background-fill-mode")"
echo " AccountsService Backgrounds: $(get_config_value "General" "use-accounts-service-backgrounds")"
echo " Lock Screen Display: $(get_config_value "LockScreen" "display")"
echo ""
echo "1) Set UI Scale (0.5 - 2.0)"
echo "2) Toggle Animations (true/false)"
echo "3) Set Background Fill Mode (fill/fit/stretch)"
echo "4) Toggle Per-User Wallpapers (AccountsService)"
echo "5) Toggle Lock Screen Display"
echo ""
echo "B) Back to main menu"
echo ""
read -p "Select option: " choice
case $choice in
1)
read -p "Enter scale value (0.5 - 2.0): " scale
if [[ "$scale" =~ ^[0-9]*\.?[0-9]+$ ]] && \
(( $(echo "$scale >= 0.5" | bc -l) )) && \
(( $(echo "$scale <= 2.0" | bc -l) )); then
set_config_value "General" "scale" "$scale"
else
warning "Invalid scale value"
fi
read -p "Press Enter to continue..."
;;
2)
current=$(get_config_value "General" "enable-animations")
if [[ "$current" == "true" ]]; then
new_value="false"
else
new_value="true"
fi
set_config_value "General" "enable-animations" "$new_value"
read -p "Press Enter to continue..."
;;
3)
echo "Select fill mode:"
echo "1) fill - Scale to fill, may crop"
echo "2) fit - Scale to fit, may show borders"
echo "3) stretch - Stretch to fill, may distort"
read -p "Choice (1-3): " mode_choice
case $mode_choice in
1) set_config_value "General" "background-fill-mode" "fill" ;;
2) set_config_value "General" "background-fill-mode" "fit" ;;
3) set_config_value "General" "background-fill-mode" "stretch" ;;
*) warning "Invalid choice" ;;
esac
read -p "Press Enter to continue..."
;;
4)
current=$(get_config_value "General" "use-accounts-service-backgrounds")
if [[ "$current" == "true" ]]; then
new_value="false"
info "Disabling per-user wallpapers - will use theme backgrounds"
else
new_value="true"
info "Enabling per-user wallpapers from AccountsService"
info "Each user will see their desktop wallpaper on the login screen"
fi
set_config_value "General" "use-accounts-service-backgrounds" "$new_value"
read -p "Press Enter to continue..."
;;
5)
current=$(get_config_value "LockScreen" "display")
if [[ "$current" == "true" ]]; then
new_value="false"
info "Disabling lock screen - will skip directly to login screen"
info "Note: On multi-monitor setups, lock screen is auto-disabled"
else
new_value="true"
info "Enabling lock screen - will show on startup (single monitor)"
info "Note: Multi-monitor setups will still skip the lock screen"
fi
set_config_value "LockScreen" "display" "$new_value"
read -p "Press Enter to continue..."
;;
[Bb]) return ;;
*) warning "Invalid option"; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Interactive menu - Lock Screen
#######################################
interactive_lockscreen() {
while true; do
clear
print_color "$BOLD" "Lock Screen Settings"
echo "════════════════════"
echo ""
echo "1) Set Background Image/Video"
echo "2) Set Background Color"
echo "3) Toggle Lock Screen Display"
echo "4) Adjust Blur Amount"
echo "5) Configure Clock"
echo "6) Configure Date"
echo "7) Configure Message"
echo ""
echo "B) Back to main menu"
echo ""
read -p "Select option: " choice
case $choice in
1)
read -p "Enter background path: " bg_path
set_config_value "LockScreen" "background" "$bg_path"
read -p "Press Enter to continue..."
;;
2)
read -p "Enter color (hex, e.g., #000000): " color
if [[ "$color" =~ ^#[0-9A-Fa-f]{6}$ ]]; then
set_config_value "LockScreen" "background-color" "$color"
set_config_value "LockScreen" "use-background-color" "true"
else
warning "Invalid color format"
fi
read -p "Press Enter to continue..."
;;
3)
current=$(get_config_value "LockScreen" "display")
if [[ "$current" == "true" ]]; then
new_value="false"
else
new_value="true"
fi
set_config_value "LockScreen" "display" "$new_value"
read -p "Press Enter to continue..."
;;
4)
read -p "Enter blur amount (0-100): " blur
if [[ "$blur" =~ ^[0-9]+$ ]] && [ "$blur" -ge 0 ] && [ "$blur" -le 100 ]; then
set_config_value "LockScreen" "blur" "$blur"
else
warning "Invalid blur value"
fi
read -p "Press Enter to continue..."
;;
5) interactive_lockscreen_clock ;;
6) interactive_lockscreen_date ;;
7) interactive_lockscreen_message ;;
[Bb]) return ;;
*) warning "Invalid option"; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Interactive menu - Lock Screen Clock
#######################################
interactive_lockscreen_clock() {
while true; do
clear
print_color "$BOLD" "Lock Screen Clock"
echo "═════════════════"
echo ""
echo "Current: $(get_config_value "LockScreen.Clock" "format")"
echo " Font: $(get_config_value "LockScreen.Clock" "font-family")"
echo " Size: $(get_config_value "LockScreen.Clock" "font-size")"
echo " Color: $(get_config_value "LockScreen.Clock" "color")"
echo ""
echo "1) Toggle Clock Display"
echo "2) Set Time Format (e.g., hh:mm or h:mm AP)"
echo "3) Set Font Family"
echo "4) Set Font Size"
echo "5) Set Color"
echo "6) Set Position"
echo ""
echo "B) Back"
echo ""
read -p "Select option: " choice
case $choice in
1)
current=$(get_config_value "LockScreen.Clock" "display")
if [[ "$current" == "true" ]]; then
new_value="false"
else
new_value="true"
fi
set_config_value "LockScreen.Clock" "display" "$new_value"
read -p "Press Enter to continue..."
;;
2)
read -p "Enter time format (e.g., hh:mm): " format
set_config_value "LockScreen.Clock" "format" "$format"
read -p "Press Enter to continue..."
;;
3)
read -p "Enter font family: " font
set_config_value "LockScreen.Clock" "font-family" "$font"
read -p "Press Enter to continue..."
;;
4)
read -p "Enter font size: " size
if [[ "$size" =~ ^[0-9]+$ ]]; then
set_config_value "LockScreen.Clock" "font-size" "$size"
else
warning "Invalid font size"
fi
read -p "Press Enter to continue..."
;;
5)
read -p "Enter color (hex): " color
if [[ "$color" =~ ^#[0-9A-Fa-f]{6}$ ]]; then
set_config_value "LockScreen.Clock" "color" "$color"
else
warning "Invalid color format"
fi
read -p "Press Enter to continue..."
;;
6)
echo "Position options:"
echo "1) top-left 2) top-center 3) top-right"
echo "4) center-left 5) center 6) center-right"
echo "7) bottom-left 8) bottom-center 9) bottom-right"
read -p "Select (1-9): " pos
positions=("" "top-left" "top-center" "top-right" "center-left" "center" "center-right" "bottom-left" "bottom-center" "bottom-right")
if [[ "$pos" =~ ^[1-9]$ ]]; then
set_config_value "LockScreen.Clock" "position" "${positions[$pos]}"
else
warning "Invalid position"
fi
read -p "Press Enter to continue..."
;;
[Bb]) return ;;
*) warning "Invalid option"; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Interactive menu - Lock Screen Date
#######################################
interactive_lockscreen_date() {
while true; do
clear
print_color "$BOLD" "Lock Screen Date"
echo "════════════════"
echo ""
echo "Current: $(get_config_value "LockScreen.Date" "format")"
echo " Color: $(get_config_value "LockScreen.Date" "color")"
echo ""
echo "1) Toggle Date Display"
echo "2) Set Date Format (e.g., dddd dd MMMM)"
echo "3) Set Color"
echo ""
echo "B) Back"
echo ""
read -p "Select option: " choice
case $choice in
1)
current=$(get_config_value "LockScreen.Date" "display")
new_value=$([[ "$current" == "true" ]] && echo "false" || echo "true")
set_config_value "LockScreen.Date" "display" "$new_value"
read -p "Press Enter to continue..."
;;
2)
read -p "Enter date format: " format
set_config_value "LockScreen.Date" "format" "$format"
read -p "Press Enter to continue..."
;;
3)
read -p "Enter color (hex): " color
if [[ "$color" =~ ^#[0-9A-Fa-f]{6}$ ]]; then
set_config_value "LockScreen.Date" "color" "$color"
else
warning "Invalid color format"
fi
read -p "Press Enter to continue..."
;;
[Bb]) return ;;
*) warning "Invalid option"; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Interactive menu - Lock Screen Message
#######################################
interactive_lockscreen_message() {
while true; do
clear
print_color "$BOLD" "Lock Screen Message"
echo "═══════════════════"
echo ""
echo "Current: $(get_config_value "LockScreen.Message" "text")"
echo ""
echo "1) Toggle Message Display"
echo "2) Set Message Text"
echo "3) Set Message Color"
echo ""
echo "B) Back"
echo ""
read -p "Select option: " choice
case $choice in
1)
current=$(get_config_value "LockScreen.Message" "display")
new_value=$([[ "$current" == "true" ]] && echo "false" || echo "true")
set_config_value "LockScreen.Message" "display" "$new_value"
read -p "Press Enter to continue..."
;;
2)
read -p "Enter message text: " text
set_config_value "LockScreen.Message" "text" "$text"
read -p "Press Enter to continue..."
;;
3)
read -p "Enter color (hex): " color
if [[ "$color" =~ ^#[0-9A-Fa-f]{6}$ ]]; then
set_config_value "LockScreen.Message" "color" "$color"
else
warning "Invalid color format"
fi
read -p "Press Enter to continue..."
;;
[Bb]) return ;;
*) warning "Invalid option"; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Interactive menu - Login Screen (simplified)
#######################################
interactive_loginscreen() {
while true; do
clear
print_color "$BOLD" "Login Screen Settings"
echo "═════════════════════"
echo ""
echo "1) Set Background"
echo "2) Configure Avatar"
echo "3) Configure Password Input"
echo "4) Configure Login Button"
echo "5) Toggle Login Area Backdrop"
echo ""
echo "B) Back to main menu"
echo ""
read -p "Select option: " choice
case $choice in
1)
read -p "Enter background path: " bg_path
set_config_value "LoginScreen" "background" "$bg_path"
read -p "Press Enter to continue..."
;;
2) interactive_loginscreen_avatar ;;
3) interactive_loginscreen_password ;;
4) interactive_loginscreen_button ;;
5) interactive_loginscreen_backdrop ;;
[Bb]) return ;;
*) warning "Invalid option"; read -p "Press Enter to continue..." ;;
esac
done
}
#######################################
# Interactive menu - Avatar
#######################################
interactive_loginscreen_avatar() {
while true; do
clear
print_color "$BOLD" "Avatar Settings"
echo "═══════════════"