-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathinstall.sh
executable file
·804 lines (730 loc) · 35.3 KB
/
install.sh
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
#!/bin/bash
#set -x
#Install script for Yaru-Blue Theme by Jannomag
clear # clear the termainl
RCol='\e[0m' # Text Reset
#options for creating snap package
snap=false
snapicons_install=false
snapthemes_install=false
path=$2
while [ ! -z "$1" ]; do
case "$1" in
--snapicons|-si)
icon_dir="$path"
snapicons_install=true
break
;;
--snapthemes|-st)
theme_dir="$path"
snapthemes_install=true
break
;;
esac
done
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m';
Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m';
Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m';
Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m'; On_Yel='\e[43m'; On_IYel='\e[0;103m';
Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m'; On_Blu='\e[44m'; On_IBlu='\e[0;104m';
Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m'; BIPur='\e[1;95m'; On_Pur='\e[45m'; On_IPur='\e[0;105m';
Cya='\e[0;36m'; BCya='\e[1;36m'; UCya='\e[4;36m'; ICya='\e[0;96m'; BICya='\e[1;96m'; On_Cya='\e[46m'; On_ICya='\e[0;106m';
Whi='\e[0;37m'; BWhi='\e[1;37m'; UWhi='\e[4;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m'; On_Whi='\e[47m'; On_IWhi='\e[0;107m';
###############
## Snap area ##
###############
# if snap argument was set ignore the rest of the script, just do the important stuff
if [ "$snapicons_install" == "true" ]; then
icon_source="./Icons/"
cp -R $icon_source/* $icon_dir
exit
fi
if [ "$snapthemes_install" == "true" ]; then
themes_source="./Themes"
cp -R $themes_source/* $theme_dir
exit
fi
echo -e "${BWhi} db db .d8b. d8888b. db db ";
echo -e " \`8b d8' d8' \`8b 88 \`8D 88 88 ";
echo -e " \`8bd8' 88ooo88 88oobY' 88 88 ";
echo -e " 88 88~~~88 88\`8b 88 88 ";
echo -e " 88 88 88 88 \`88. 88b d88 ";
echo -e " YP YP YP 88 YD ~Y8888P' ";
echo -e "${BBlu} .o88b. ${BYel} .d88b. ${BPur}88 ${BCya}.d88b. ${BGre}d8888b. ${BRed}.d8888. ";
echo -e "${BBlu}d8P Y8 ${BYel}.8P Y8. ${BPur}88 ${BCya} .8P Y8.${BGre} 88 \`8D ${BRed}88' YP ";
echo -e "${BBlu}8P ${BYel}88 88 ${BPur}88 ${BCya} 88 88${BGre} 88oobY' ${BRed}\`8bo. ";
echo -e "${BBlu}8b ${BYel}88 88 ${BPur}88 ${BCya} 88 88${BGre} 88\`8b ${BRed}\`Y8b. ";
echo -e "${BBlu}Y8b d8 ${BYel}\`8b d8'${BPur} 88booo.${BCya} \`8b d8'${BGre} 88 \`88. ${BRed}db 8D ";
echo -e "${BBlu} \`Y88P'${BYel} \`Y88P'${BPur} Y88888P${BCya} \`Y88P'${BGre} 88 YD ${BRed}\`8888Y' ";
echo -e " ";
VERSION=$(grep -F 'Version' ./README.md | egrep -o "([0-9]{1,}\.)+[0-9]{1,}") # Extracting version from readme.me so I just have to change it there.
echo -e "Version $VERSION ";
echo -e "${RCol}"
#Intro
echo -e "${RCol}"
echo -e "${BBlu}WELCOME FRIEND!${RCol}"
echo -e "${BBlu}This script will guide you through the installation of this theme.${RCol}"
echo -e ""
echo -e "${BYel}Press any key to start the installer or CTRL-C to quit at any time...${RCol}"
read -n 1 # wait for user input "any key"
clear # clear terminmal again
echo -e "${BWhi}##########---------- NOTE ----------##########"
echo -e "# THIS THEME IS JUST A FORK OF THE ORIGINAL YARU THEME #"
echo -e "# I MODIFIED THE COLORS AND SOME IMAGES / SVG GRAPHICS #"
echo -e "# THE ORIGINAL CREDITS FOR THIS GREAT WORK GO TO THE #"
echo -e "# UBUNTU DEVELOPER TEAM! #"
echo -e "# ---------------------------------------------------- #"
echo -e "# FEEL FREE TO MODIFY MY FORK #"
echo -e "# ---------------------------------------------------- #"
echo -e "# MY E-MAIL FOR SUGGESTIONS: [email protected] #"
echo -e "# ---------------------------------------------------- #"
echo -e "# THIS THEMES WERE RELEASED BY ME IN APRIL 2019 #"
echo -e "# ON gnome-looks.org #"
echo -e "##########---------- NOTE ----------##########"
echo -e ""
#getting home directory
homedir=$( getent passwd "$USER" | cut -d: -f6 )
username=$( getent passwd "$USER" | cut -d: -f1 )
#Check if root
if [[ "$EUID" -ne 0 ]]; then
isroot="false"
theme_install_dir="$homedir/.local/share/themes"
icon_install_dir="$homedir/.local/share/icons"
echo -e "${BGre}You ran this script as normal user, default install path is set to\n'$theme_install_dir' and '$icon_install_dir'\nwhich can also be changed later!${RCol}"
sleep 0.5
else
isroot="true"
homedir=$( getent passwd "$SUDO_USER" | cut -d: -f6 )
theme_install_dir="/usr/share/themes"
icon_install_dir="/usr/share/icons"
echo -e "${BRed}You ran this script as root, default install path is set to\n'$theme_install_dir' and '$icon_install_dir' which can also be changed later!${RCol}"
fi
#Determine user name for later
RUID=$(who | awk 'FNR == 1 {print $1}')
RUSER_UID=$(id -u ${RUID})
####################
# #
# Function section #
# #
####################
#### Function for package color selection
package_color_menu () {
select package_color in "${@}"; do
if [ 1 -le "$REPLY" ] && [ "$REPLY" -le $(($#)) ]; then
echo -e "${Yel}Okay, '$package_color' is set!${RCol}"
break;
else
echo -e "${Yel}Incorrect input, please enter a number from the list!${RCol}"
fi
done
}
#### Function for icon color selection
icon_color_menu () {
select icon_color in "${@}"; do
if [ 1 -le "$REPLY" ] && [ "$REPLY" -le $(($#)) ]; then
echo -e "${Yel}Okay, '$icon_color' is set for the icons!${RCol}"
break;
else
echo -e "${Yel}Incorrect input, please enter a number from the list!${RCol}"
fi
done
}
### Those functions will create selection menus with all the colors from the array "colors". I can use them as often as I want, I just need to remap the output variables. I've created two menus to have a better overview.
###################
# #
# PICKING SECTION #
# #
###################
#
# In this section the script will ask what it should install
#
# setting variables for the first while loop.
picking=true
install=false
enable=false
package_install=false
color=none
# The color array - THIS revolutionized my old script...I can add colors as much as I want, if they're present as themes...nice
colors=(Amber Aqua Aubergine Blue Brown Cinnamon Deepblue Green Grey Lavender MATE Pink Purple Orange Red Teal Yellow)
echo -e ""
echo -e "${Yel}Let me ask you some questions...${RCol}"
while [ "$picking" == "true" ] && [ "$install" == "false" ] # Starting the while loop for the installation process
do
echo -e "${BYel}Do you want to install the complete package?${RCol}"
echo -e "${Yel}This contains all themes, icons and cursors for every color.${RCol}"
select ask_install_type in yes no # asking if the whole package should be installed, set the variable "package_install" with the answer.
do
case $ask_install_type in
yes)
package_install=true
break
;;
no)
package_install=false
break
;;
*)
echo -e "${Yel}Please choose 1 or 2.${RCol}"
;;
esac
done
if [ "$package_install" == "false" ]; then # If the user DON'T want to install everything...
echo -e "${BYel}Okay, which color do you want to install?${RCol}" # Ask the user which color should be installed...
package_color_menu "${colors[@]}" # calling my function
main_color_set=true
install_theme=true
echo -e "${BYel}Do you want to install an icon pack, if yes, maybe a different color?${RCol}"
select ask_install_icons in yes different no # Ask the user if an icon pack should be installed and set the variables with the users answer
do
case $ask_install_icons in
yes)
install_icons=true
icon_color=$package_color
change_icon_color=false
break ;;
different)
install_icons=true
change_icon_color=true
break ;;
no)
install_icons=false
break ;;
*)
echo -e "${Yel}Wrong input, please enter a number from the list above...${RCol}"
;;
esac
done
if [ "$install_icons" == "true" ] && [ "$change_icon_color" == "true" ]; then # If the user want's to install an icon pack...
echo -e "${BYel}Which color do you want to install for your icons?${RCol}"
icon_color_menu "${colors[@]}" # call the color menu function
fi
fi ## Closing the "package or not package" IF
# Creating a summary of things to do
echo -e ""
echo -e "${BYel}Okay, that should be enough for now...${RCol}"
echo -e "${Yel}I'll do following for you:${RCol}"
if [ "$package_install" == "true" ]; then # If the whole packages should be installed...
echo -e "${BGre} - Install the complete package${RCol}"
echo -e "${Gre} Which includes the themes, icons and cursors of every color.${RCol}"
fi
if [ "$package_install" == "false" ]; then # If just a single theme should be installed...
echo -e "${BGre} - Install Yaru-$package_color theme.${RCol}"
if [ "$install_icons" == "true" ] && [ "$change_icon_color" == "true" ]; then # If a different icon pack than the selected color should be installed...
echo -e "${BGre} - Install Yaru-$icon_color icons.${RCol}"
elif [ "$install_icons" == "true" ] && [ "$change_icon_color" == "false" ]; then # If the icon pack should've the same color as the theme...
echo -e "${BGre} - Install Yaru-$icon_color icons.${RCol}"
else
echo -e "${BGre} - DON'T install any icons.${RCol}" # Or don't install any icons...
fi
fi
echo -e "${BYel}Is this correct?${RCol}"
select ask_list_correct in yes no # Asking the user if this summary is correct, set the variables with the answer
do
case $ask_list_correct in
yes)
echo -e "${Yel}Great! I'll do it!${RCol}"
start_install=true
break ;;
no)
echo -e "${Yel}Okay...Let's start over...${RCol}"
echo -e ""
echo -e ""
echo -e ""
start_install=false
startover=true
break ;;
*)
echo -e "${BYel}Incorrect answer!${RCol}"
;;
esac
done
if [ "$start_install" == "true" ]; then # If the answer was "yes", the following variables will be set to break the current loop and start the next while loop.
picking=false
install=true
install_done=false
fi
done
######################
# #
# INSTALLING SECTION #
# #
######################
#
# In this section the files will be installed
#
while [ "$picking" == "false" ] && [ "$install" == "true" ] && [ "$install_done" == "false" ]; do # so the while loop begins...
# setting path variables for normal users
themes_source="./Themes/"
icon_source="./Icons/"
theme_dir_def="$homedir/.local/share/themes/"
icon_dir_def="$homedir/.local/share/icons/"
# and also for the snobs with root privileges
if [ "$isroot" == "true" ]; then
echo -e "${BRed}Root privileges detected!${RCol}"
echo -e "${Yel}This isn't a problem, I just wanted you to tell this...${RCol}"
theme_dir_def="/usr/share/themes"
icon_dir_def="/usr/share/icons"
fi
echo -e ""
echo -e "${BYel}Where do you want to install the themes?${RCol}"
echo -e ""
echo -e "${BYel}Please enter your theme path [$theme_dir_def]: ${RCol}" && read -e theme_dir # asking for the path, if nothing is entered by the user 'theme_dir_def' will be used - new variable: 'theme_dir'
theme_dir="${theme_dir:-$theme_dir_def}"
if [[ ! -d "$theme_dir" ]]; then # and if this directory doesn't exists, create it.
echo -e "${Yel}$theme_dir doesn't exist, creating now${RCol}"
mkdir -p $theme_dir
fi
echo -e "${BYel}Please enter your icon path [$icon_dir_def]: ${RCol}" && read -e icon_dir # asking for the path, if nothing is entered by the user 'icon_dir_def' will be used - new variable: 'icon_dir'
icon_dir="${icon_dir:-$icon_dir_def}"
if [[ ! -d "$icon_dir" ]]; then # and if this directory doesn't exists, create it.
echo -e "${Yel}$icon_dir doesn't exist, creating now${RCol}"
mkdir -p $icon_dir
fi
# as the echo says, copy the files
echo -e "${BYel}Copying files...${RCol}"
if [ "$package_install" == "true" ]; then # just copy everything from both directories if the whole package was installed
cp -R $themes_source/* $theme_dir
cp -R $icon_source/* $icon_dir
if [ "$icon_dir" == "$homedir/.local/share/icons/" ]; then # if .local/share/icons was set as directory, link the icon directories to .icons as well to prevent bugs I notied in Ubuntu 20.10 (cursors not working)
mkdir -p $homedir/.icons
ln -sf $icon_dir/Yaru-* $homedir/.icons
fi
fi
if [ "$package_install" == "false" ]; then # and if the user just wanted one color, just copy this specific one using 'package_color' and 'icon_color' - you remember? The functions above
cp -R $themes_source/Yaru-$package_color* $theme_dir/
cp -R $icon_source/Yaru-$icon_color $icon_dir/
if [ "$icon_dir" == "$homedir/.local/share/icons/" ]; then # if .local/share/icons was set as directory, link the icon directories to .icons as well to prevent bugs I notied in Ubuntu 20.10 (cursors not working)
mkdir -p $homedir/.icons
ln -sf $icon_dir/Yaru-* $homedir/.icons
fi
fi
echo -e "${BYel}Done!${RCol}"
echo -e ""
echo -e "${BYel}Do you want to enable themes, icons and other stuff?${RCol}"
select ask_enable in yes no # asking if the user wants to enable themes, icons and shit. If yes, set variables for the next while loop, if not, set them so the next while loop won't start.
do
case $ask_enable in
yes)
enable=true
install_done=true
install=false
picking=false
break ;;
no)
echo -e "${Gre}Okay, that's fine. We're done!${RCol}"
install_done=true
install=false
picking=false
enable=false
exit
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
done
####################
# #
# Enabling section #
# #
####################
#
# In this section, the script will ask the user if he/she/it wants to enable parts of Yaru-Colors.
# This happens in a while loop just like the other parts before...
#
while [ "$install" == false ] && [ "$picking" == "false" ] && [ "$enable" == "true" ]; do
echo -e ""
### Theme questions
if [ "$package_install" == "true" ]; then
echo -e "${BYel}Do you want to enable a theme, if yes, which variant?${RCol}" # Ask for "a" theme if the complete package was installed
else
echo -e "${BYel}Do you want to enable the theme if yes, which variant?${RCol}" # Ask for "the" theme if just one was installed
fi
# Asking for yes / no just as usual to set the enable_theme variable
select ask_enable_theme in light normal dark no
do
case $ask_enable_theme in
light)
enable_theme=true
theme_variant=-light # this will be added so variants are now a thing here with this script...such wow!
break ;;
normal)
enable_theme=true
theme_variant=
break ;;
dark)
enable_theme=true
theme_variant=-dark
break ;;
no)
enable_theme=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
if [ "$enable_theme" == "true" ] && [ "$package_install" == "true" ]; then # Ask for color if a theme should be enabled and the whole package was installed
echo -e "${BYel}Okay, which color should it be?${RCol}"
package_color_menu "${colors[@]}" # Just using the function from the top of this script to make it short
enable_theme_color=$package_color # Remap the variable for reusing the original variable later
theme_color_set=true # Setting a new variable to check if color was chosen or not
fi
### Theme done
### Shell questions
echo -e ""
if [ ! -d $homedir/.local/share/gnome-shell/extensions/user-theme* ]; then # checking if the user-themes extension of gnome-shell is enabled, it's needed to be able to set a different gnome-shell theme (why, though?)
echo -e "${Red}I just wanted to ask you if I should enable a gnome-shell theme...\nBut the user-themes extension is not installed.\nPlease install it to be able to set a gnome-shell theme.${RCol}" #...and if not, just tell this to the user
echo -e "${Red}You can get this by using 'apt install gnome-shell-extensions'\nor here: https://extensions.gnome.org/extension/19/user-themes/"
else
echo -e "${Gre}Detected user-themes extension!${RCol}"
if [ "$package_install" == "true" ]; then
echo -e "${BYel}Do you want to enable a shell theme if yes, which variant?${RCol}" # Ask for "a" shell theme if the complete package was installed
else
echo -e "${BYel}Do you want to enable the shell theme if yes, which variant?${RCol}" # Ask for "the" shell theme if just one was installed
fi
# Just the same as before...
select ask_enable_shell in light dark no
do
case $ask_enable_shell in
light)
enable_shell=true
shell_variant=-light
break ;;
dark)
enable_shell=true
shell_variant=-dark
break ;;
no)
enable_shell=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
if [ "$enable_shell" == "true" ] && [ "$package_install" == "true" ]; then # Ask for color if a shell theme should be enabled and the whole package was installed
echo -e "${BYel}Which shell color do you want to enable?${RCol}"
package_color_menu "${colors[@]}" # Just using the function from the top of this script to make it short
enable_shell_color=$package_color # Remap the variable for reusing the original variable later
shell_color_set=true # Setting a new variable to check if color was chosen or not
fi
fi
# ask for enabling the gdm3 compatibility - this will work on Ubuntu only, because every distro may use it's own gnome-shell theme resources.
# For non Ubuntu-Distros: Please install it manually, check the readme!
if [ "$enable_shell" == "true" ] && [ -d "/usr/share/gnome-shell/theme/Yaru" ]; then
echo -e "${BYel}Do you want to enable the GDM3 theme (root required!)?${RCol}"
select ask_enable_gdm3 in yes no
do
case $ask_enable_gdm3 in
yes)
enable_gdm3=true
break ;;
no)
enable_gdm3=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
fi
### Shell done
### Icons questions
echo -e ""
if [ "$package_install" == "true" ]; then
echo -e "${BYel}Do you want to enable an icon pack?${RCol}" # Ask for "an" icon pack if the complete package was installed
else
echo -e "${BYel}Do you want to enable the icon pack?${RCol}" # Ask for "the" icon if just one was installed
fi
# aaand again...
select ask_enable_icons in yes no
do
case $ask_enable_icons in
yes)
enable_icons=true
break ;;
no)
enable_icons=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
if [ "$enable_icons" == "true" ] && [ "$package_install" == "true" ]; then # Ask for color if an icon pack should be enabled and the whole package was installed
echo -e "${BYel}Which icon color do you want to enable?${RCol}"
icon_color_menu "${colors[@]}" # Just using the function from the top of this script to make it short
enable_icon_color=$icon_color # Remap the variable for reusing the original variable later
icon_color_set=true # Setting a new variable to check if color was chosen or not
fi
### Icons done
### Cursor questions
echo -e ""
if [ "$package_install" == "true" ]; then
echo -e "${BYel}Do you want to enable a cursor theme?${RCol}" # Ask for "a" cursor theme if the complete package was installed
else
echo -e "${BYel}Do you want to enable the cursor theme?${RCol}" # Ask for "the" cursor theme if just one was installed
fi
# Again, the same procedure as before
select ask_enable_cursor in yes no
do
case $ask_enable_cursor in
yes)
enable_cursor=true
break ;;
no)
enable_cursor=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
if [ "$enable_cursor" == "true" ] && [ "$package_install" == "true" ]; then # Ask for color if a cursor theme should be enabled and the whole package was installed
echo -e "${BYel}Which cursor theme do you want to enable?${RCol}"
icon_color_menu "${colors[@]}" # Just using the function from the top of this script to make it short
enable_cursor_color=$icon_color # Remap the variable for reusing the original variable later
cursor_color_set=true # Setting a new variable to check if color was chosen or not
fi
### Cursor done
### Dock questions
echo -e ""
if [ -d /usr/share/gnome-shell/extensions/[email protected] ]; then # check if ubuntu dock is installed
if [ "$package_install" == "true" ]; then
echo -e "${BYel}Do you want to set a dock indicator color?${RCol}" # Ask for "a" cursor theme if the complete package was installed
else
echo -e "${BYel}Do you want to set the dock indicator?${RCol}" # Ask for "the" cursor theme if just one was installed
fi
# last but not least...the same procedure as before
select ask_enable_dock in yes no
do
case $ask_enable_dock in
yes)
enable_dock=true
break ;;
no)
enable_dock=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
if [ "$enable_dock" == "true" ] && [ "$package_install" == "true" ]; then # Ask for color if a cursor theme should be enabled and the whole package was installed
echo -e "${BYel}Which color do you want for the dock indicators?${RCol}"
icon_color_menu "${colors[@]}" # Just using the function from the top of this script to make it short
enable_dock_color=$icon_color # Remap the variable for reusing the original variable later
dock_color_set=true # Setting a new variable to check if color was chosen or not
elif [ "$package_install" == "false" ]; then
enable_dock_color=$package_color
fi
fi
### Dock done
### Summary of what this script will do, just for visualization
echo -e "${Yel}Okay, I'll do following for you:\n${RCol}"
# Theme part:
if [ "$theme_color_set" == "true" ]; then # If package was installed and user selected a color...
echo -e "${BGre} - ENABLE Yaru-$enable_theme_color$theme_variant (user selected) GTK theme${RCol}"
elif [ "$enable_theme" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
echo -e "${BGre} - ENABLE Yaru-$package_color$theme_variant GTK theme${RCol}"
elif [ "$enable_theme" == "false" ]; then # If the user don't want to enable a theme
echo -e "${BRed} - NOT changing GTK theme${RCol}"
fi
# Shell part:
if [ "$shell_color_set" == "true" ]; then # If package was installed and user selected a color...
echo -e "${BGre} - ENABLE Yaru-$enable_shell_color$shell_variant (user selected) SHELL theme${RCol}"
elif [ "$enable_shell" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
echo -e "${BGre} - ENABLE Yaru-$package_color$shell_variant SHELL theme${RCol}"
elif [ "$enable_shell" == "false" ]; then # If the user don't want to enable a shell theme
echo -e "${BRed} - NOT changing SHELL theme${RCol}"
fi
if [ "$enable_gdm3" == "true" ]; then
if [ "$shell_color_set" == "true" ]; then
echo -e "${BGre} - ENABLE Yaru-$enable_shell_color (user selected) GDM3 compatibility${RCol}"
elif [ "$enable_shell" == "true" ]; then
echo -e "${BGre} - ENABLE Yaru-$package_color GDM3 compatibility${RCol}"
fi
fi
# Icon part:
if [ "$icon_color_set" == "true" ]; then # If package was installed and user selected a color...
echo -e "${BGre} - ENABLE Yaru-$enable_icon_color (user selected) icon pack${RCol}"
elif [ "$enable_icons" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
echo -e "${BGre} - ENABLE Yaru-$package_color icon pack${RCol}"
elif [ "$enable_icons" == "false" ]; then # If the user don't want to enable an icon pack
echo -e "${BRed} - NOT changing icons${RCol}"
fi
# Cursor part:
if [ "$cursor_color_set" == "true" ]; then # If package was installed and user selected a color...
echo -e "${BGre} - ENABLE Yaru-$enable_cursor_color (user selected) cursor theme${RCol}"
elif [ "$enable_cursor" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
echo -e "${BGre} - ENABLE Yaru-$package_color cursor theme${RCol}"
elif [ "$enable_cursor" == "false" ]; then # If the user don't want to enable a theme
echo -e "${BRed} - NOT changing cursors${RCol}"
fi
# Dock part:
if [ "$dock_color_set" == "true" ]; then # If package was installed and user selected a color...
echo -e "${BGre} - ENABLE Yaru-$enable_dock_color (user selected) for the dock indicators${RCol}"
elif [ "$enable_dock" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
echo -e "${BGre} - ENABLE Yaru-$package_color for the dock indicators${RCol}"
elif [ "$enable_dock" == "false" ]; then # If the user don't want to enable a theme
echo -e "${BRed} - NOT changing dock indicators${RCol}"
fi
echo -e ""
echo -e "${BYel}Is this summary correct?${RCol}"
select ask_summary in yes no
do
case $ask_summary in
yes)
execute_tasks=true
break ;;
no)
execute_tasks=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
if [ "$execute_tasks" == "true" ]; then
enable=false
execute=true
fi
done
### Execute the things the user wants...
# Again in a while loop
while [ "$execute" == "true" ]; do
# It's the same as above, but with the actual commands
# Theme part:
if [ "$theme_color_set" == "true" ]; then # If package was installed and user selected a color...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface gtk-theme "Yaru-$enable_theme_color$theme_variant" 2> /dev/null
elif [ "$enable_theme" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface gtk-theme "Yaru-$package_color$theme_variant" 2> /dev/null
fi
# Shell part:
if [ "$shell_color_set" == "true" ]; then # If package was installed and user selected a color...
# This is a bit complicated due an old bug in user-themes extensions where there's no schema set in the shell-theme settings. I'll added the fix to this script to make it as easy as possible.
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.shell.extensions.user-theme name "Yaru-$enable_shell_color$shell_variant"
if [ ! "$?" -eq "0" ]; then # so, if the above command to change the shell theme doesn't work, ask if the script should fix this.
echo -e "${BRed}ERROR, this is caused by an old bug in the extension.\nDon't worry! I can fix it, but I need root privileges.${RCol}"
echo -e "${BRed}Is this okay for you? Take a look in the readme learn more.${RCol}"
select shell_error_fix in yes no
do
case $shell_error_fix in
yes)
echo -e "${Yel}Okay, I'll fix this.${RCol}"
echo -e "${Yel}Please enter your passwort if asked.${RCol}"
# I've got this fix from here: https://gist.github.com/atiensivu/fcc3183e9a6fd74ec1a283e3b9ad05f0 - it puts the missing file from ~ to the glib-2.0 directory and re-compiles the glib schemas
sudo cp $HOME/.local/share/gnome-shell/extensions/[email protected]/schemas/org.gnome.shell.extensions.user-theme.gschema.xml /usr/share/glib-2.0/schemas && sudo glib-compile-schemas /usr/share/glib-2.0/schemas
break ;;
no)
echo -e "${Yel}Okay, skipping shell theme. Please read the readme for this!${RCol}"
enable_shell=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
fi
if [ "$enable_gdm3" == "true" ]; then
sudo cp /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource.bakup_yarucolors
sudo cp $theme_dir/Yaru-$enable_shell_color/gnome-shell/*.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
sudo update-alternatives --set gdm3-theme.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
fi
elif [ "$enable_shell" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
# And the same as above, including the fix.
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.shell.extensions.user-theme name "Yaru-$package_color$shell_variant"
if [ ! "$?" -eq "0" ]; then # so, if the above command to change the shell theme doesn't work, ask if the script should fix this.
echo -e "${BRed}ERROR, this is caused by an old bug. Don't worry!\nI can fix it, but I need root privileges.${RCol}"
echo -e "${BRed}Is this okay for you?${RCol}"
select shell_error_fix in yes no
do
case $shell_error_fix in
yes)
echo -e "${Yel}Okay, I'll fix this, please read the readme to see what I've done.${RCol}"
echo -e "${Yel}Please enter your passwort...${RCol}"
# I've got this fix from here: https://gist.github.com/atiensivu/fcc3183e9a6fd74ec1a283e3b9ad05f0 - it puts the missing file from ~ to the glib-2.0 directory and re-compiles the glib schemas
sudo cp $homedir/.local/share/gnome-shell/extensions/[email protected]/schemas/org.gnome.shell.extensions.user-theme.gschema.xml /usr/share/glib-2.0/schemas && sudo glib-compile-schemas /usr/share/glib-2.0/schemas
break ;;
no)
echo -e "${Yel}Okay, skipping shell theme. Please read the readme for this!${RCol}"
enable_shell=false
break ;;
*)
echo -e "${Red}Wrong input!${RCol}"
;;
esac
done
fi
if [ "$enable_gdm3" == "true" ]; then
sudo cp /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource.bakup_yarucolors
sudo cp $theme_dir/Yaru-$package_color/gnome-shell/*.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
sudo update-alternatives --set gdm3-theme.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
fi
fi
# Icon part:
if [ "$icon_color_set" == "true" ]; then # If package was installed and user selected a color...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface icon-theme "Yaru-$enable_icon_color" 2> /dev/null
elif [ "$enable_icons" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface icon-theme "Yaru-$package_color" 2> /dev/null
fi
# Cursor part:
if [ "$cursor_color_set" == "true" ]; then # If package was installed and user selected a color...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface cursor-theme "Yaru-$enable_cursor_color" 2> /dev/null
elif [ "$enable_cursor" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface cursor-theme "Yaru-$package_color" 2> /dev/null
fi
# dock part:
# setting color codes variables:
if [ "$enable_dock_color" == "Amber" ]; then
dock_color='#eea834'
elif [ "$enable_dock_color" == "Aqua" ]; then
dock_color='#41c6c8'
elif [ "$enable_dock_color" == "Blue" ]; then
dock_color='#208fe9'
elif [ "$enable_dock_color" == "Brown" ]; then
dock_color='#995640'
elif [ "$enable_dock_color" == "Deepblue" ]; then
dock_color='#25469d'
elif [ "$enable_dock_color" == "Green" ]; then
dock_color='#3eb34f'
elif [ "$enable_dock_color" == "Grey" ]; then
dock_color='#9c9c9c'
elif [ "$enable_dock_color" == "MATE" ]; then
dock_color='#78ab50'
elif [ "$enable_dock_color" == "Orange" ]; then
dock_color='#e95420'
elif [ "$enable_dock_color" == "Pink" ]; then
dock_color='#e920a3'
elif [ "$enable_dock_color" == "Amber" ]; then
dock_color='#924d8b'
elif [ "$enable_dock_color" == "Red" ]; then
dock_color='#e92020'
elif [ "$enable_dock_color" == "Teal" ]; then
dock_color='#16a085'
elif [ "$enable_dock_color" == "Yellow" ]; then
dock_color='#e9ba20'
fi
if [ "$cursor_color_set" == "true" ]; then # If package was installed and user selected a color...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.shell.extensions.dash-to-dock custom-theme-running-dots-color "$dock_color" 2> /dev/null
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.shell.extensions.dash-to-dock custom-theme-running-dots-border-color "$dock_color" 2> /dev/null
elif [ "$enable_cursor" == "true" ]; then # If package was not installed theres just one color defined with $package_color ...
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.shell.extensions.dash-to-dock custom-theme-running-dots-color "$dock_color" 2> /dev/null
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.shell.extensions.dash-to-dock custom-theme-running-dots-border-color "$dock_color" 2> /dev/null
fi
echo -e "${BYel}Everything should be done!${RCol}"
echo -e "${Yel}If something is missing, use gnome-tweak tool!${RCol}"
echo -e "${Yel}That's it! BYE and THANK YOU!${RCol}"
execute=false
done
##### Okay, enough for today. What's done?
# - Picking colors and package / single method
# - Copying files
# - Enabling themes, icons and cursors
# - Setting dock colors
# - ADDING COMMENTS!!!!! IMPORTANT !!!1111
# What's not done?
#