2021-04-08 06:12:34 +02:00
|
|
|
#! /usr/bin/env bash
|
2020-07-14 18:35:03 +02:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
# WARNING: Please make this shell not working-directory dependant, for example
|
2021-06-03 01:43:49 +02:00
|
|
|
# instead of using 'ls blabla', use 'ls "${REPO_DIR}/blabla"'
|
2021-04-08 02:09:27 +02:00
|
|
|
#
|
|
|
|
# WARNING: Don't use "cd" in this shell, use it in a subshell instead,
|
|
|
|
# for example ( cd blabla && do_blabla ) or $( cd .. && do_blabla )
|
2021-06-11 13:59:07 +02:00
|
|
|
#
|
|
|
|
# SUGGESTION: Please don't put any dependency installation here
|
2020-07-14 18:35:03 +02:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
###############################################################################
|
|
|
|
# VARIABLES & HELP #
|
|
|
|
###############################################################################
|
2020-07-14 18:35:03 +02:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
readonly REPO_DIR="$(dirname "$(readlink -m "${0}")")"
|
|
|
|
source "${REPO_DIR}/lib-install.sh"
|
2020-07-31 11:30:07 +02:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
# Customization, default values
|
|
|
|
colors=("${COLOR_VARIANTS[@]}")
|
|
|
|
opacities=("${OPACITY_VARIANTS[@]}")
|
2020-07-31 11:30:07 +02:00
|
|
|
|
2020-07-14 18:35:03 +02:00
|
|
|
usage() {
|
2021-04-08 02:09:27 +02:00
|
|
|
# Please specify their default value manually, some of them are come from _variables.scss
|
|
|
|
# You also have to check and update them regurally
|
|
|
|
helpify_title
|
|
|
|
helpify "-d, --dest" "DIR" "Set destination directory" "Default is '${THEME_DIR}'"
|
|
|
|
helpify "-n, --name" "NAME" "Set theme name" "Default is '${THEME_NAME}'"
|
|
|
|
helpify "-o, --opacity" "[$(IFS='|'; echo "${OPACITY_VARIANTS[*]}")]" "Set theme opacity variants" "Repeatable. Default is all variants"
|
|
|
|
helpify "-c, --color" "[$(IFS='|'; echo "${COLOR_VARIANTS[*]}")]" "Set theme color variants" "Repeatable. Default is all variants"
|
|
|
|
helpify "-a, --alt" "[$(IFS='|'; echo "${ALT_VARIANTS[*]}")|all]" "Set window control buttons variant" "Repeatable. Default is 'normal'"
|
|
|
|
helpify "-t, --theme" "[$(IFS='|'; echo "${THEME_VARIANTS[*]}")|all]" "Set theme accent color" "Repeatable. Default is BigSur-like theme"
|
2021-08-21 05:41:37 +02:00
|
|
|
helpify "-p, --panel-opacity" "[$(IFS='|'; echo "${PANEL_OPACITY_VARIANTS[*]}")]" "Set panel transparency" "Default is 15%"
|
|
|
|
helpify "-P, --panel-size" "[$(IFS='|'; echo "${PANEL_SIZE_VARIANTS[*]}")]" "Set Gnome shell panel height size" "Default is 32px"
|
2021-04-09 17:14:17 +02:00
|
|
|
helpify "-s, --size" "[$(IFS='|'; echo "${SIDEBAR_SIZE_VARIANTS[*]}")]" "Set Nautilus sidebar minimum width" "Default is 200px"
|
2021-04-08 02:09:27 +02:00
|
|
|
helpify "-i, --icon" "[$(IFS='|'; echo "${ICON_VARIANTS[*]}")]" "Set 'Activities' icon" "Default is 'standard'"
|
2021-04-29 04:48:16 +02:00
|
|
|
helpify "-b, --background" "[default|blank|IMAGE_PATH]" "Set gnome-shell background image" "Default is BigSur-like wallpaper"
|
2022-05-05 11:53:22 +02:00
|
|
|
helpify "-m, --monterey" "" "Set to MacOS Monterey style" ""
|
|
|
|
helpify "-l, --libadwaita" "" "Install gtk-4.0 theme into config for libadwaita" ""
|
2021-06-09 05:28:32 +02:00
|
|
|
helpify "-N, --nautilus-style" "[$(IFS='|'; echo "${NAUTILUS_STYLE_VARIANTS[*]}")]" "Set Nautilus style" "Default is BigSur-like style (stabled sidebar)"
|
2021-05-15 02:14:04 +02:00
|
|
|
helpify "-HD, --highdefinition" "" "Set to High Definition size" "Default is laptop size"
|
|
|
|
helpify "--normal, --normalshowapps" "" "Set gnome-shell show apps button style to normal" "Default is bigsur"
|
2021-05-09 08:25:44 +02:00
|
|
|
helpify "--round, --roundedmaxwindow" "" "Set maximized window to rounded" "Default is square"
|
2021-07-19 16:24:56 +02:00
|
|
|
helpify "--right, --rightplacement" "" "Set Nautilus titlebutton placement to right" "Default is left"
|
|
|
|
helpify "--black, --blackfont" "" "Set panel font color to black" "Default is white"
|
2021-11-04 04:09:13 +01:00
|
|
|
helpify "--darker, --darkercolor" "" "Install darker '${THEME_NAME}' dark themes" ""
|
2022-01-29 11:36:27 +01:00
|
|
|
helpify "--nord, --nordcolor" "" "Install '${THEME_NAME}' Nord ColorScheme themes" ""
|
2021-04-08 02:09:27 +02:00
|
|
|
helpify "--dialog, --interactive" "" "Run this installer interactively, with dialogs" ""
|
2021-06-15 15:15:34 +02:00
|
|
|
helpify "--silent-mode" "" "Meant for developers: ignore any confirm prompt and params become more strict" ""
|
2021-07-19 16:24:56 +02:00
|
|
|
helpify "-r, --remove, -u, --uninstall" "" "Remove all installed ${THEME_NAME} themes" ""
|
2021-04-08 02:09:27 +02:00
|
|
|
helpify "-h, --help" "" "Show this help" ""
|
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# MAIN #
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#-----------------------------PARSE ARGUMENTS---------------------------------#
|
2020-07-14 18:35:03 +02:00
|
|
|
|
2021-06-12 09:01:28 +02:00
|
|
|
echo
|
|
|
|
|
2021-01-16 13:16:30 +01:00
|
|
|
while [[ $# -gt 0 ]]; do
|
2021-04-08 02:09:27 +02:00
|
|
|
# Don't show any dialog here. Let this loop checks for errors or shows help
|
|
|
|
# We can only show dialogs when there's no error and no -r parameter
|
|
|
|
#
|
|
|
|
# * shift for parameters that have no value
|
|
|
|
# * shift 2 for parameter that have a value
|
|
|
|
#
|
|
|
|
# Please don't exit any error here if possible. Let it show all error warnings
|
|
|
|
# at once
|
|
|
|
|
2021-01-16 13:16:30 +01:00
|
|
|
case "${1}" in
|
2021-11-04 04:09:13 +01:00
|
|
|
# Parameters that don't require value
|
2021-04-08 02:09:27 +02:00
|
|
|
-r|--remove|-u|-uninstall)
|
|
|
|
uninstall='true'; shift ;;
|
2021-06-15 15:15:34 +02:00
|
|
|
--silent-mode)
|
|
|
|
full_sudo "${1}"; silent_mode='true'; shift ;;
|
2021-04-08 02:09:27 +02:00
|
|
|
--dialog|--interactive)
|
|
|
|
interactive='true'; shift ;;
|
2021-04-21 12:40:03 +02:00
|
|
|
--normal|--normalshowapps)
|
|
|
|
showapps_normal="true"; shift ;;
|
2021-05-09 08:25:44 +02:00
|
|
|
--right|--rightplacement)
|
|
|
|
right_placement="true"; shift ;;
|
|
|
|
--round|--roundedmaxwindow)
|
2021-04-09 17:06:04 +02:00
|
|
|
max_round="true"; shift ;;
|
2021-07-19 16:24:56 +02:00
|
|
|
--black|--blackfont)
|
|
|
|
black_font="true"; shift ;;
|
2021-11-04 04:09:13 +01:00
|
|
|
--darker|--darkercolor)
|
|
|
|
darker="true"; shift ;;
|
2021-12-26 15:16:39 +01:00
|
|
|
--nord|--nordcolor)
|
2022-02-23 14:11:08 +01:00
|
|
|
colorscheme="-nord"; shift ;;
|
2021-05-15 02:14:04 +02:00
|
|
|
-HD|--highdefinition)
|
|
|
|
compact="false"; shift ;;
|
2021-07-19 16:24:56 +02:00
|
|
|
-m|--monterey)
|
|
|
|
monterey="true"; shift ;;
|
2022-05-05 11:53:22 +02:00
|
|
|
-l|--libadwaita)
|
|
|
|
libadwaita="true"; shift ;;
|
2021-11-04 04:09:13 +01:00
|
|
|
# Parameters that require value, single use
|
2021-04-29 04:45:57 +02:00
|
|
|
-b|--background)
|
|
|
|
check_param "${1}" "${1}" "${2}" "must" "must" "must" "false" && shift 2 || shift ;;
|
2021-01-16 13:16:30 +01:00
|
|
|
-d|--dest)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "must" "must" "not-at-all" && shift 2 || shift ;;
|
2021-01-16 13:16:30 +01:00
|
|
|
-n|--name)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "must" "must" "not-at-all" && shift 2 || shift ;;
|
|
|
|
-i|--icon)
|
|
|
|
check_param "${1}" "${1}" "${2}" "must" "must" "must" && shift 2 || shift ;;
|
|
|
|
-s|--size)
|
|
|
|
check_param "${1}" "${1}" "${2}" "optional" "optional" "optional" && shift 2 || shift ;;
|
2021-08-21 05:41:37 +02:00
|
|
|
-p|--panel-opacity)
|
|
|
|
check_param "${1}" "${1}" "${2}" "optional" "optional" "optional" && shift 2 || shift ;;
|
|
|
|
-P|--panel-size)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "optional" "optional" "optional" && shift 2 || shift ;;
|
|
|
|
-N|--nautilus-style)
|
|
|
|
check_param "${1}" "${1}" "${2}" "optional" "optional" "optional" && shift 2 || shift ;;
|
|
|
|
# Parameters that require value, multiple use
|
2021-01-16 13:16:30 +01:00
|
|
|
-a|--alt)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "not-at-all" "must" "must" && shift 2 || shift ;;
|
2021-01-16 13:16:30 +01:00
|
|
|
-o|--opacity)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "not-at-all" "must" "must" && shift 2 || shift ;;
|
2020-07-14 18:35:03 +02:00
|
|
|
-c|--color)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "not-at-all" "must" "must" && shift 2 || shift ;;
|
2020-12-27 13:38:25 +01:00
|
|
|
-t|--theme)
|
2021-04-08 02:09:27 +02:00
|
|
|
check_param "${1}" "${1}" "${2}" "not-at-all" "must" "must" && shift 2 || shift ;;
|
2021-07-19 16:24:56 +02:00
|
|
|
-h|--help)
|
|
|
|
need_help="true"; shift ;;
|
2020-07-14 18:35:03 +02:00
|
|
|
*)
|
2021-04-08 02:09:27 +02:00
|
|
|
prompt -e "ERROR: Unrecognized installation option '${1}'."
|
|
|
|
has_any_error="true"; shift ;;
|
2020-07-14 18:35:03 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
finalize_argument_parsing
|
2021-01-16 13:16:30 +01:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
#---------------------------START INSTALL THEMES-------------------------------#
|
2021-01-16 13:16:30 +01:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
if [[ "${uninstall}" == 'true' ]]; then
|
2021-11-04 02:55:52 +01:00
|
|
|
prompt -i "Removing '${name}' gtk themes in '${dest}'... \n"
|
|
|
|
prompt -w "REMOVAL: Non file-related parameters will be ignored. \n"
|
2021-04-08 02:09:27 +02:00
|
|
|
remove_themes
|
2022-05-05 14:32:07 +02:00
|
|
|
prompt -s "Done! All '${name}' gtk themes in has been removed."
|
2021-11-04 02:55:52 +01:00
|
|
|
|
|
|
|
if [[ -f "${MISC_GR_FILE}.bak" ]]; then
|
|
|
|
prompt -e "Find installed GDM theme, you need to run: 'sudo ./tweaks.sh -g -r' to remove it!"
|
|
|
|
fi
|
2021-04-08 02:09:27 +02:00
|
|
|
else
|
|
|
|
if [[ "${interactive}" == 'true' ]]; then
|
|
|
|
show_panel_opacity_dialog; show_sidebar_size_dialog; show_nautilus_style_dialog
|
2021-06-11 15:48:43 +02:00
|
|
|
echo; prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo
|
2021-06-02 18:04:59 +02:00
|
|
|
else
|
|
|
|
show_needed_dialogs
|
|
|
|
fi
|
2021-01-16 13:16:30 +01:00
|
|
|
|
2022-05-05 11:53:22 +02:00
|
|
|
prompt -w "Removing the old '${name}${colorscheme}' themes..."
|
2021-01-16 13:16:30 +01:00
|
|
|
|
2021-04-08 02:09:27 +02:00
|
|
|
remove_themes; customize_theme; avoid_variant_duplicates; echo
|
2021-04-04 10:39:10 +02:00
|
|
|
|
2022-05-05 11:53:22 +02:00
|
|
|
prompt -w "Installing '${name}${colorscheme}' themes in '${dest}'..."; echo
|
|
|
|
|
|
|
|
prompt -t "--->>> GTK | GNOME Shell | Cinnamon | Metacity | XFWM | Plank <<<---"
|
2021-04-08 02:09:27 +02:00
|
|
|
prompt -i "Color variants : $( IFS=';'; echo "${colors[*]}" )"
|
|
|
|
prompt -i "Theme variants : $( IFS=';'; echo "${themes[*]}" )"
|
|
|
|
prompt -i "Opacity variants : $( IFS=';'; echo "${opacities[*]}" )"
|
|
|
|
prompt -i "Alt variants : $( IFS=';'; echo "${alts[*]}" )"
|
|
|
|
prompt -i "Icon variant : ${icon}"
|
|
|
|
prompt -i "Nautilus variant : ${nautilus_style}"
|
2020-12-29 14:24:03 +01:00
|
|
|
|
2021-04-21 10:39:47 +02:00
|
|
|
echo; install_themes; echo; prompt -s "Done!"
|
2020-07-14 18:35:03 +02:00
|
|
|
|
2022-05-05 11:53:22 +02:00
|
|
|
if [[ "${libadwaita}" == 'true' ]]; then
|
|
|
|
install_libadwaita
|
|
|
|
echo; prompt -w "Installed gtk-4.0 into config for libadwaita!"
|
|
|
|
fi
|
2021-05-14 10:19:14 +02:00
|
|
|
|
2021-08-14 14:44:00 +02:00
|
|
|
if (is_running "xfce4-session"); then
|
|
|
|
msg="XFCE: you may need to run 'xfce4-panel -r' after changing your theme to fix your panel opacity."
|
2021-08-15 05:35:20 +02:00
|
|
|
elif (is_my_distro "solus") && (is_running "gnome-session"); then
|
2021-06-25 10:16:50 +02:00
|
|
|
msg="GNOME: you may need to disable 'User Themes' extension to fix your dock."
|
2022-05-05 11:53:22 +02:00
|
|
|
# elif (is_running "gnome-session") && [[ "${GNOME_VERSION}" == "3-28" ]]; then
|
|
|
|
# msg="GNOME: you may need to disable 'User Themes' extension to fix your logout and authentication dialog."
|
2021-06-25 10:16:50 +02:00
|
|
|
fi
|
2020-12-29 09:15:26 +01:00
|
|
|
|
2021-06-25 10:16:50 +02:00
|
|
|
if [[ "${msg}" ]]; then
|
2021-04-21 10:39:47 +02:00
|
|
|
echo; prompt -w "${msg}"
|
2021-06-25 10:16:50 +02:00
|
|
|
notif_msg="${msg}\n\n${final_msg}"
|
2021-04-21 10:39:47 +02:00
|
|
|
else
|
|
|
|
notif_msg="${final_msg}"
|
|
|
|
fi
|
|
|
|
|
2021-06-12 09:01:28 +02:00
|
|
|
echo; prompt -w "${final_msg}"
|
2022-05-05 14:32:07 +02:00
|
|
|
|
|
|
|
if [[ -x /usr/bin/notify-send && "$UID" != '0' ]]; then
|
|
|
|
notify-send "'${name}' theme has been installed. Enjoy!" "${notif_msg}" -i "dialog-information-symbolic"
|
|
|
|
fi
|
2020-12-07 07:44:28 +01:00
|
|
|
fi
|
2021-06-12 09:01:28 +02:00
|
|
|
|
|
|
|
echo
|