1#!/usr/local/bin/bash
2
3ROOT_UID=0
4DEST_DIR=
5
6# Destination directory
7if [ "$UID" -eq "$ROOT_UID" ]; then
8  DEST_DIR="/usr/share/themes"
9else
10  DEST_DIR="$HOME/.themes"
11fi
12
13SRC_DIR=$(cd $(dirname $0) && pwd)
14
15THEME_NAME=Qogir
16THEME_VARIANTS=('' '-manjaro' '-ubuntu')
17WIN_VARIANTS=('' '-win')
18COLOR_VARIANTS=('' '-light' '-dark')
19LOGO_NAME=''
20
21image=''
22window=''
23square=''
24
25theme_color='default'
26
27SASSC_OPT="-M -t expanded"
28
29if [[ "$(command -v gnome-shell)" ]]; then
30  SHELL_VERSION="$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f -1)"
31  echo "Your gnome-shell version is '$(gnome-shell --version)'"
32  if [[ "${SHELL_VERSION:-}" -ge "40" ]]; then
33    GS_VERSION="new"
34  else
35    GS_VERSION="old"
36  fi
37  else
38    echo "'gnome-shell' not found, using styles for last gnome-shell version available."
39    GS_VERSION="new"
40fi
41
42usage() {
43cat << EOF
44Usage: $0 [OPTION]...
45
46OPTIONS:
47  -d, --dest DIR          Specify destination directory (Default: $DEST_DIR)
48
49  -n, --name NAME         Specify theme name (Default: $THEME_NAME)
50
51  -t, --theme VARIANT     Specify theme primary color variant(s) [default|manjaro|ubuntu|all] (Default: blue color)
52
53  -c, --color VARIANT     Specify theme color variant(s) [standard|light|dark] (Default: All variants)
54
55  -g, --gdm               Install GDM theme, this option need root user authority! please run this with sudo
56
57  -r, --revert            revert GDM theme, this option need root user authority! please run this with sudo
58
59  --tweaks                Specify versions for tweaks [image|square|round]
60                          1. image:    Install with a background image on (Nautilus/Nemo)
61                          2. square:   Install square window button like Windows 10
62                          3. round:    Install rounded window and popup/menu version
63
64  -h, --help              Show help
65EOF
66}
67
68install() {
69  local dest=${1}
70  local name=${2}
71  local theme=${3}
72  local color=${4}
73  local logo=${5}
74
75  [[ ${color} == '-dark' ]] && local ELSE_DARK=${color}
76  [[ ${color} == '-light' ]] && local ELSE_LIGHT=${color}
77
78  local THEME_DIR=${dest}/${name}${theme}${color}
79
80  [[ -d ${THEME_DIR} ]] && rm -rf ${THEME_DIR}
81
82  theme_tweaks && install_theme_color
83
84  echo "Installing '${THEME_DIR}'..."
85
86  mkdir -p                                                                           ${THEME_DIR}
87  cp -r ${SRC_DIR}/COPYING                                                           ${THEME_DIR}
88  cp -r ${SRC_DIR}/AUTHORS                                                           ${THEME_DIR}
89
90  echo "[Desktop Entry]"                                                          >> ${THEME_DIR}/index.theme
91  echo "Type=X-GNOME-Metatheme"                                                   >> ${THEME_DIR}/index.theme
92  echo "Name=${name}${theme}${color}"                                             >> ${THEME_DIR}/index.theme
93  echo "Comment=An Clean Gtk+ theme based on Flat Design"                         >> ${THEME_DIR}/index.theme
94  echo "Encoding=UTF-8"                                                           >> ${THEME_DIR}/index.theme
95  echo ""                                                                         >> ${THEME_DIR}/index.theme
96  echo "[X-GNOME-Metatheme]"                                                      >> ${THEME_DIR}/index.theme
97  echo "GtkTheme=${name}${theme}${color}"                                         >> ${THEME_DIR}/index.theme
98  echo "MetacityTheme=${name}${theme}${color}"                                    >> ${THEME_DIR}/index.theme
99  echo "IconTheme=${name}${theme}${ELSE_DARK}"                                    >> ${THEME_DIR}/index.theme
100  echo "CursorTheme=Adwaita"                                                      >> ${THEME_DIR}/index.theme
101  echo "ButtonLayout=menu:minimize,maximize,close"                                >> ${THEME_DIR}/index.theme
102
103  # GTK 2.0
104  mkdir -p                                                                           ${THEME_DIR}/gtk-2.0
105  cp -r ${SRC_DIR}/src/gtk-2.0/{apps.rc,panel.rc,main.rc,xfce-notify.rc}             ${THEME_DIR}/gtk-2.0
106  cp -r ${SRC_DIR}/src/gtk-2.0/assets/assets${theme}${ELSE_DARK}                     ${THEME_DIR}/gtk-2.0/assets
107  cp -r ${SRC_DIR}/src/gtk-2.0/theme${theme}/gtkrc${color}                           ${THEME_DIR}/gtk-2.0/gtkrc
108  cp -r ${SRC_DIR}/src/gtk-2.0/menubar-toolbar${color}.rc                            ${THEME_DIR}/gtk-2.0/menubar-toolbar.rc
109
110  # GTK 3.0
111  mkdir -p                                                                           ${THEME_DIR}/gtk-3.0
112  cp -r ${SRC_DIR}/src/gtk/assets/assets${theme}                                     ${THEME_DIR}/gtk-3.0/assets
113
114  if [[ -f ${SRC_DIR}/src/gtk/assets/logos/logo-${logo}.svg ]] ; then
115    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo-${logo}.svg                           ${THEME_DIR}/gtk-3.0/assets/logo.svg
116    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo@2-${logo}.svg                         ${THEME_DIR}/gtk-3.0/assets/logo@2.svg
117  else
118    echo "${logo} icon not supported, default icon will install..."
119    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo-.svg                                  ${THEME_DIR}/gtk-3.0/assets/logo.svg
120    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo@2-.svg                                ${THEME_DIR}/gtk-3.0/assets/logo@2.svg
121  fi
122
123  cp -r ${SRC_DIR}/src/gtk/assets/assets-common/*                                    ${THEME_DIR}/gtk-3.0/assets
124
125  if [[ "$tweaks" == 'true' ]]; then
126    sassc $SASSC_OPT ${SRC_DIR}/src/gtk/theme-3.0/gtk${color}.scss                   ${THEME_DIR}/gtk-3.0/gtk.css
127  else
128    cp -r ${SRC_DIR}/src/gtk/theme-3.0/gtk${color}.css                               ${THEME_DIR}/gtk-3.0/gtk.css
129  fi
130
131  if [[ ${color} != '-dark' ]]; then
132    if [[ "$tweaks" == 'true' ]]; then
133      sassc $SASSC_OPT ${SRC_DIR}/src/gtk/theme-3.0/gtk-dark.scss                    ${THEME_DIR}/gtk-3.0/gtk-dark.css
134    else
135      cp -r ${SRC_DIR}/src/gtk/theme-3.0/gtk-dark.css                                ${THEME_DIR}/gtk-3.0/gtk-dark.css
136    fi
137  fi
138
139  cp -r ${SRC_DIR}/src/gtk/assets/thumbnail${theme}${ELSE_DARK}.png                  ${THEME_DIR}/gtk-3.0/thumbnail.png
140
141  # GTK 4.0
142  mkdir -p                                                                           ${THEME_DIR}/gtk-4.0
143  cp -r ${SRC_DIR}/src/gtk/assets/assets${theme}                                     ${THEME_DIR}/gtk-4.0/assets
144
145  if [[ -f ${SRC_DIR}/src/gtk/assets/logos/logo-${logo}.svg ]] ; then
146    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo-${logo}.svg                           ${THEME_DIR}/gtk-4.0/assets/logo.svg
147    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo@2-${logo}.svg                         ${THEME_DIR}/gtk-4.0/assets/logo@2.svg
148  else
149    echo "${logo} icon not supported, default icon will install..."
150    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo-.svg                                  ${THEME_DIR}/gtk-4.0/assets/logo.svg
151    cp -r ${SRC_DIR}/src/gtk/assets/logos/logo@2-.svg                                ${THEME_DIR}/gtk-4.0/assets/logo@2.svg
152  fi
153
154  cp -r ${SRC_DIR}/src/gtk/assets/assets-common/*                                    ${THEME_DIR}/gtk-4.0/assets
155
156  if [[ "$tweaks" == 'true' ]]; then
157    sassc $SASSC_OPT ${SRC_DIR}/src/gtk/theme-4.0/gtk${color}.scss                   ${THEME_DIR}/gtk-4.0/gtk.css
158  else
159    cp -r ${SRC_DIR}/src/gtk/theme-4.0/gtk${color}.css                               ${THEME_DIR}/gtk-4.0/gtk.css
160  fi
161
162  if [[ ${color} != '-dark' ]]; then
163    if [[ "$tweaks" == 'true' ]]; then
164      sassc $SASSC_OPT ${SRC_DIR}/src/gtk/theme-4.0/gtk-dark.scss                    ${THEME_DIR}/gtk-4.0/gtk-dark.css
165    else
166      cp -r ${SRC_DIR}/src/gtk/theme-4.0/gtk-dark.css                                ${THEME_DIR}/gtk-4.0/gtk-dark.css
167    fi
168  fi
169
170  cp -r ${SRC_DIR}/src/gtk/assets/thumbnail${theme}${ELSE_DARK}.png                  ${THEME_DIR}/gtk-4.0/thumbnail.png
171
172 # GNOME SHELL
173  mkdir -p                                                                           ${THEME_DIR}/gnome-shell
174  cp -r ${SRC_DIR}/src/gnome-shell/common-assets                                     ${THEME_DIR}/gnome-shell/assets
175  cp -r ${SRC_DIR}/src/gnome-shell/assets${theme}/{background.jpg,calendar-today.svg} ${THEME_DIR}/gnome-shell/assets
176  cp -r ${SRC_DIR}/src/gnome-shell/assets${theme}/assets${ELSE_DARK}/*.svg           ${THEME_DIR}/gnome-shell/assets
177
178  if [[ -f ${SRC_DIR}/src/gnome-shell/logos/logo-${logo}.svg ]] ; then
179    cp -r ${SRC_DIR}/src/gnome-shell/logos/logo-${logo}.svg                          ${THEME_DIR}/gnome-shell/assets/activities.svg
180  else
181    echo "${logo} icon not supported, Qogir icon will install..."
182    cp -r ${SRC_DIR}/src/gnome-shell/logos/logo-qogir.svg                            ${THEME_DIR}/gnome-shell/assets/activities.svg
183  fi
184
185  cp -r ${SRC_DIR}/src/gnome-shell/icons                                             ${THEME_DIR}/gnome-shell
186  cp -r ${SRC_DIR}/src/gnome-shell/pad-osd.css                                       ${THEME_DIR}/gnome-shell
187
188  if [[ "${GS_VERSION:-}" == 'new' ]]; then
189    if [[ "$tweaks" == 'true' ]]; then
190      sassc $SASSC_OPT ${SRC_DIR}/src/gnome-shell/theme-40-0/gnome-shell${ELSE_DARK}.scss ${THEME_DIR}/gnome-shell/gnome-shell.css
191    else
192      cp -r ${SRC_DIR}/src/gnome-shell/theme-40-0/gnome-shell${ELSE_DARK}.css        ${THEME_DIR}/gnome-shell/gnome-shell.css
193    fi
194  else
195    if [[ "$tweaks" == 'true' ]]; then
196      sassc $SASSC_OPT ${SRC_DIR}/src/gnome-shell/theme-3-32/gnome-shell${ELSE_DARK}.scss ${THEME_DIR}/gnome-shell/gnome-shell.css
197    else
198      cp -r ${SRC_DIR}/src/gnome-shell/theme-3-32/gnome-shell${ELSE_DARK}.css        ${THEME_DIR}/gnome-shell/gnome-shell.css
199    fi
200  fi
201
202  cd ${THEME_DIR}/gnome-shell
203  ln -sf assets/no-events.svg no-events.svg
204  ln -sf assets/process-working.svg process-working.svg
205  ln -sf assets/no-notifications.svg no-notifications.svg
206
207  # CINNAMON
208  mkdir -p                                                                           ${THEME_DIR}/cinnamon
209  cp -r ${SRC_DIR}/src/cinnamon/assets${theme}/common-assets                         ${THEME_DIR}/cinnamon
210  cp -r ${SRC_DIR}/src/cinnamon/assets${theme}/assets${ELSE_DARK}                    ${THEME_DIR}/cinnamon/assets
211  if [[ "$tweaks" == 'true' ]]; then
212    sassc $SASSC_OPT ${SRC_DIR}/src/cinnamon/cinnamon${ELSE_DARK}.scss               ${THEME_DIR}/cinnamon/cinnamon.css
213  else
214    cp -r ${SRC_DIR}/src/cinnamon/cinnamon${ELSE_DARK}.css                           ${THEME_DIR}/cinnamon/cinnamon.css
215  fi
216
217  cp -r ${SRC_DIR}/src/cinnamon/thumbnail${theme}${ELSE_DARK}.png                    ${THEME_DIR}/cinnamon/thumbnail.png
218
219  # METACITY
220  mkdir -p                                                                           ${THEME_DIR}/metacity-1
221
222  if [[ "$square" == 'true' ]]; then
223    cp -r ${SRC_DIR}/src/metacity-1/assets${ELSE_LIGHT}-win/*.png                    ${THEME_DIR}/metacity-1
224    cp -r ${SRC_DIR}/src/metacity-1/metacity-theme-3-win.xml                         ${THEME_DIR}/metacity-1/metacity-theme-3.xml
225    cp -r ${SRC_DIR}/src/metacity-1/metacity-theme-1${ELSE_LIGHT}-win.xml            ${THEME_DIR}/metacity-1/metacity-theme-1.xml
226  else
227    cp -r ${SRC_DIR}/src/metacity-1/assets${ELSE_LIGHT}/*.png                        ${THEME_DIR}/metacity-1
228    cp -r ${SRC_DIR}/src/metacity-1/metacity-theme-3.xml                             ${THEME_DIR}/metacity-1/metacity-theme-3.xml
229    cp -r ${SRC_DIR}/src/metacity-1/metacity-theme-1${ELSE_LIGHT}.xml                ${THEME_DIR}/metacity-1/metacity-theme-1.xml
230  fi
231
232  cp -r ${SRC_DIR}/src/metacity-1/thumbnail${ELSE_LIGHT}.png                         ${THEME_DIR}/metacity-1/thumbnail.png
233  cd ${THEME_DIR}/metacity-1
234  ln -s metacity-theme-1.xml metacity-theme-2.xml
235
236  # XFWM4
237  mkdir -p                                                                           ${THEME_DIR}/xfwm4
238
239  if [[ "$square" == 'true' ]]; then
240    cp -r ${SRC_DIR}/src/xfwm4/themerc-win${ELSE_LIGHT}                              ${THEME_DIR}/xfwm4/themerc
241    cp -r ${SRC_DIR}/src/xfwm4/assets-win${ELSE_LIGHT}/*.png                         ${THEME_DIR}/xfwm4
242  else
243    cp -r ${SRC_DIR}/src/xfwm4/themerc${ELSE_LIGHT}                                  ${THEME_DIR}/xfwm4/themerc
244    cp -r ${SRC_DIR}/src/xfwm4/assets${ELSE_LIGHT}/*.png                             ${THEME_DIR}/xfwm4
245  fi
246
247  # OTHER
248  cp -r ${SRC_DIR}/src/plank                                                         ${THEME_DIR}
249  cp -r ${SRC_DIR}/src/unity                                                         ${THEME_DIR}
250  cp -r ${SRC_DIR}/src/xfce-notify-4.0                                               ${THEME_DIR}
251}
252
253# Backup and install files related to GDM theme
254
255GS_THEME_FILE="/usr/share/gnome-shell/gnome-shell-theme.gresource"
256SHELL_THEME_FOLDER="/usr/share/gnome-shell/theme"
257ETC_THEME_FOLDER="/etc/alternatives"
258ETC_THEME_FILE="/etc/alternatives/gdm3.css"
259UBUNTU_THEME_FILE="/usr/share/gnome-shell/theme/ubuntu.css"
260UBUNTU_NEW_THEME_FILE="/usr/share/gnome-shell/theme/gnome-shell.css"
261
262install_gdm() {
263  local GDM_THEME_DIR="${1}/${2}${3}${4}"
264
265  if [[ -f "$GS_THEME_FILE" ]] && command -v glib-compile-resources >/dev/null ; then
266    echo "Installing '$GS_THEME_FILE'..."
267    cp -an "$GS_THEME_FILE" "$GS_THEME_FILE.bak"
268    glib-compile-resources \
269      --sourcedir="$GDM_THEME_DIR/gnome-shell" \
270      --target="$GS_THEME_FILE" \
271      "${SRC_DIR}/src/gnome-shell/gnome-shell-theme.gresource.xml"
272  fi
273
274  if [[ -f "$UBUNTU_THEME_FILE" && -f "$GS_THEME_FILE.bak" ]]; then
275    echo "Installing '$UBUNTU_THEME_FILE'..."
276    cp -an "$UBUNTU_THEME_FILE" "$UBUNTU_THEME_FILE.bak"
277    rm -rf "$GS_THEME_FILE"
278    mv "$GS_THEME_FILE.bak" "$GS_THEME_FILE"
279    cp -af "$GDM_THEME_DIR/gnome-shell/gnome-shell.css" "$UBUNTU_THEME_FILE"
280  fi
281
282  if [[ -f "$ETC_THEME_FILE" && -f "$GS_THEME_FILE.bak" ]]; then
283    echo "Installing Ubuntu gnome-shell theme..."
284    cp -an "$ETC_THEME_FILE" "$ETC_THEME_FILE.bak"
285    rm -rf "$ETC_THEME_FILE" "$GS_THEME_FILE"
286    mv "$GS_THEME_FILE.bak" "$GS_THEME_FILE"
287    [[ -d $SHELL_THEME_FOLDER/$THEME_NAME ]] && rm -rf $SHELL_THEME_FOLDER/$THEME_NAME
288    cp -r "$GDM_THEME_DIR/gnome-shell" "$SHELL_THEME_FOLDER/$THEME_NAME"
289    cd "$ETC_THEME_FOLDER"
290    ln -s "$SHELL_THEME_FOLDER/$THEME_NAME/gnome-shell.css" gdm3.css
291  fi
292}
293
294revert_gdm() {
295  if [[ -f "$GS_THEME_FILE.bak" ]]; then
296    echo "reverting '$GS_THEME_FILE'..."
297    rm -rf "$GS_THEME_FILE"
298    mv "$GS_THEME_FILE.bak" "$GS_THEME_FILE"
299  fi
300
301  if [[ -f "$UBUNTU_THEME_FILE.bak" ]]; then
302    echo "reverting '$UBUNTU_THEME_FILE'..."
303    rm -rf "$UBUNTU_THEME_FILE"
304    mv "$UBUNTU_THEME_FILE.bak" "$UBUNTU_THEME_FILE"
305  fi
306
307  if [[ -f "$ETC_THEME_FILE.bak" ]]; then
308    echo "reverting Ubuntu gnome-shell theme..."
309    rm -rf "$ETC_THEME_FILE"
310    mv "$ETC_THEME_FILE.bak" "$ETC_THEME_FILE"
311    [[ -d $SHELL_THEME_FOLDER/$THEME_NAME ]] && rm -rf $SHELL_THEME_FOLDER/$THEME_NAME
312  fi
313}
314
315while [[ $# -gt 0 ]]; do
316  case "${1}" in
317    -d|--dest)
318      dest="${2}"
319      if [[ ! -d "${dest}" ]]; then
320        echo "ERROR: Destination directory does not exist."
321        exit 1
322      fi
323      shift 2
324      ;;
325    -n|--name)
326      name="${2}"
327      shift 2
328      ;;
329    -l|--logo)
330      logo="${2}"
331      shift 2
332      ;;
333    -g|--gdm)
334      gdm='true'
335      shift
336      ;;
337    -r|--revert)
338      revert='true'
339      shift
340      ;;
341    -t|--theme)
342      accent='true'
343      shift
344      for theme in "${@}"; do
345        case "${theme}" in
346          default)
347            themes+=("${THEME_VARIANTS[0]}")
348            shift 1
349            ;;
350          manjaro)
351            themes+=("${THEME_VARIANTS[1]}")
352            shift 1
353            ;;
354          ubuntu)
355            themes+=("${THEME_VARIANTS[2]}")
356            shift 1
357            ;;
358          all)
359            themes+=("${THEME_VARIANTS[@]}")
360            shift 1
361            ;;
362          -*|--*)
363            break
364            ;;
365          *)
366            echo "ERROR: Unrecognized theme variant '$1'."
367            echo "Try '$0 --help' for more information."
368            exit 1
369            ;;
370        esac
371      done
372      ;;
373    -c|--color)
374      shift
375      for color in "${@}"; do
376        case "${color}" in
377          standard)
378            colors+=("${COLOR_VARIANTS[0]}")
379            shift 1
380            ;;
381          light)
382            colors+=("${COLOR_VARIANTS[1]}")
383            shift 1
384            ;;
385          dark)
386            colors+=("${COLOR_VARIANTS[2]}")
387            shift 1
388            ;;
389          -*|--*)
390            break
391            ;;
392          *)
393            echo "ERROR: Unrecognized color variant '$1'."
394            echo "Try '$0 --help' for more information."
395            exit 1
396            ;;
397        esac
398      done
399      ;;
400    --tweaks)
401      shift
402      for tweak in "${@}"; do
403        case "${tweak}" in
404          image)
405            image='true'
406            shift
407            ;;
408          round)
409            window='round'
410            shift
411            ;;
412          square)
413            square='true'
414            shift
415            ;;
416          -*|--*)
417            break
418            ;;
419          *)
420            echo "ERROR: Unrecognized tweak variant '$1'."
421            echo "Try '$0 --help' for more information."
422            exit 1
423            ;;
424        esac
425      done
426      ;;
427    -h|--help)
428      usage
429      exit 0
430      ;;
431    *)
432      echo "ERROR: Unrecognized installation option '$1'."
433      echo "Try '$0 --help' for more information."
434      exit 1
435      ;;
436  esac
437done
438
439# check command avalibility
440function has_command() {
441  command -v $1 > /dev/null
442}
443
444install_package() {
445  if [ ! "$(which sassc 2> /dev/null)" ]; then
446    echo "\n sassc needs to be installed to generate the css."
447
448    if has_command zypper; then
449
450      read -p "[ trusted ] specify the root password : " -t 20 -s
451      [[ -n "$REPLY" ]] && {
452        echo "\n running: sudo zypper in sassc "
453        sudo -S <<< $REPLY zypper in sassc
454      }|| {
455        echo  "\n Operation canceled  Bye"
456        exit 1
457      }
458
459      elif has_command apt; then
460
461      read -p "[ trusted ] specify the root password : " -t 20 -s
462      [[ -n "$REPLY" ]] && {
463        echo "\n running: sudo apt install sassc "
464        sudo -S <<< $REPLY apt install sassc
465      }|| {
466        echo  "\n Operation canceled  Bye"
467        exit 1
468      }
469
470      elif has_command dnf; then
471
472      read -p "[ trusted ] specify the root password : " -t 20 -s
473      [[ -n "$REPLY" ]] && {
474        echo "\n running: sudo dnf install sassc "
475        sudo -S <<< $REPLY dnf install sassc
476      }|| {
477        echo  "\n Operation canceled  Bye"
478        exit 1
479      }
480
481      elif has_command yum; then
482
483      read -p "[ trusted ] specify the root password : " -t 20 -s
484      [[ -n "$REPLY" ]] && {
485        echo "\n running: sudo yum install sassc "
486        sudo -S <<< $REPLY yum install sassc
487      }|| {
488        echo  "\n Operation canceled  Bye"
489        exit 1
490      }
491
492      elif has_command pacman; then
493
494      read -p "[ trusted ] specify the root password : " -t 20 -s
495      [[ -n "$REPLY" ]] && {
496        echo "\n running: sudo pacman -S --noconfirm sassc "
497        sudo -S <<< $REPLY pacman -S --noconfirm sassc
498      }|| {
499        echo  "\n Operation canceled  Bye"
500        exit 1
501      }
502
503    fi
504  fi
505}
506
507install_theme() {
508  for theme in "${themes[@]-${THEME_VARIANTS[0]}}"; do
509    for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
510      install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${theme}" "${color}" "${logo:-${LOGO_NAME}}"
511    done
512  done
513}
514
515tweaks_temp() {
516  cp -rf ${SRC_DIR}/src/_sass/_tweaks.scss ${SRC_DIR}/src/_sass/_tweaks-temp.scss
517}
518
519install_image() {
520  sed -i "/\$background:/s/default/image/" ${SRC_DIR}/src/_sass/_tweaks-temp.scss
521  echo -e "Install Nautilus with background image version ..."
522}
523
524install_win_titlebutton() {
525  sed -i "/\$titlebutton:/s/circle/square/" ${SRC_DIR}/src/_sass/_tweaks-temp.scss
526  echo -e "Install Square titlebutton version ..."
527}
528
529install_round_window() {
530  sed -i "/\$window:/s/default/round/" ${SRC_DIR}/src/_sass/_tweaks-temp.scss
531  echo -e "Install Round window version ..."
532}
533
534install_theme_color() {
535  if [[ "$theme" != '' ]]; then
536    case "$theme" in
537      -manjaro)
538        theme_color='manjaro'
539        ;;
540      -ubuntu)
541        theme_color='ubuntu'
542        ;;
543    esac
544    sed -i "/\$theme:/s/default/${theme_color}/" ${SRC_DIR}/src/_sass/_tweaks-temp.scss
545  fi
546}
547
548theme_tweaks() {
549  if [[ "$image" == "true" || "$square" == "true" || "$accent" == 'true' || "$window" == 'round' ]]; then
550    tweaks='true'
551    install_package; tweaks_temp
552  fi
553
554  if [[ "$image" == "true" ]] ; then
555    install_image
556  fi
557
558  if [[ "$square" == "true" ]] ; then
559    install_win_titlebutton
560  fi
561
562  if [[ "$window" == "round" ]] ; then
563    install_round_window
564  fi
565}
566
567if [[ "${gdm:-}" != 'true' && "${revert:-}" != 'true' ]]; then
568  install_theme
569fi
570
571if [[ "${gdm:-}" == 'true' && "${revert:-}" != 'true' && "$UID" -eq "$ROOT_UID" ]]; then
572  install_theme && install_gdm "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${theme}" "${color}"
573fi
574
575if [[ "${gdm:-}" != 'true' && "${revert:-}" == 'true' && "$UID" -eq "$ROOT_UID" ]]; then
576  revert_gdm
577fi
578
579echo
580echo Done.
581