Colloid-gtk-theme/install.sh

719 lines
22 KiB
Bash
Raw Normal View History

2021-12-09 08:53:04 -05:00
#! /usr/bin/env bash
set -Eeo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
SRC_DIR="${REPO_DIR}/src"
2022-02-20 22:17:51 -05:00
source "${REPO_DIR}/gtkrc.sh"
2024-04-12 14:34:30 -04:00
source "${REPO_DIR}/assets.sh"
2022-02-20 22:17:51 -05:00
2021-12-09 08:53:04 -05:00
ROOT_UID=0
DEST_DIR=
2023-08-12 11:52:57 -04:00
scheme=
2021-12-31 02:08:42 -05:00
window=
2021-12-09 08:53:04 -05:00
# Destination directory
if [ "$UID" -eq "$ROOT_UID" ]; then
DEST_DIR="/usr/share/themes"
else
DEST_DIR="$HOME/.themes"
fi
SASSC_OPT="-M -t expanded"
THEME_NAME=Colloid
2022-05-14 13:41:43 -04:00
THEME_VARIANTS=('' '-Purple' '-Pink' '-Red' '-Orange' '-Yellow' '-Green' '-Teal' '-Grey')
SCHEME_VARIANTS=('' '-Nord' '-Dracula' '-Gruvbox' '-Everforest' '-Catppuccin')
2022-05-14 13:41:43 -04:00
COLOR_VARIANTS=('' '-Light' '-Dark')
SIZE_VARIANTS=('' '-Compact')
2021-12-09 08:53:04 -05:00
if [[ "$(command -v gnome-shell)" ]]; then
2024-05-12 17:36:14 -04:00
echo && gnome-shell --version
2021-12-09 08:53:04 -05:00
SHELL_VERSION="$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f -1)"
2024-04-12 09:48:29 -04:00
if [[ "${SHELL_VERSION:-}" -ge "46" ]]; then
GS_VERSION="46-0"
elif [[ "${SHELL_VERSION:-}" -ge "44" ]]; then
2023-04-11 10:38:51 -04:00
GS_VERSION="44-0"
elif [[ "${SHELL_VERSION:-}" -ge "42" ]]; then
2022-04-23 05:58:25 -04:00
GS_VERSION="42-0"
2022-04-22 08:19:01 -04:00
elif [[ "${SHELL_VERSION:-}" -ge "40" ]]; then
2022-04-23 05:58:25 -04:00
GS_VERSION="40-0"
2021-12-09 08:53:04 -05:00
else
2022-04-23 05:58:25 -04:00
GS_VERSION="3-28"
2021-12-09 08:53:04 -05:00
fi
2024-04-12 09:48:29 -04:00
else
echo "'gnome-shell' not found, using styles for last gnome-shell version available."
GS_VERSION="46-0"
2021-12-09 08:53:04 -05:00
fi
usage() {
cat << EOF
Usage: $0 [OPTION]...
OPTIONS:
-d, --dest DIR Specify destination directory (Default: $DEST_DIR)
-n, --name NAME Specify theme name (Default: $THEME_NAME)
-t, --theme VARIANT Specify theme color variant(s) [default|purple|pink|red|orange|yellow|green|teal|grey|all] (Default: blue)
2022-05-14 13:41:43 -04:00
-c, --color VARIANT Specify color variant(s) [standard|light|dark] (Default: All variants))
2021-12-09 08:53:04 -05:00
2022-05-14 13:41:43 -04:00
-s, --size VARIANT Specify size variant [standard|compact] (Default: standard variant)
2021-12-09 08:53:04 -05:00
2024-05-12 17:36:14 -04:00
-l, --libadwaita Install specify gtk-4.0 theme into config folder ($HOME/.config/gtk-4.0) for all gtk4 apps use this theme
Default ColorSchemes theme will follow the system style (light/dark mode switch), all ColorSchemes versions not support this !
2024-05-12 17:36:14 -04:00
Options for default ColorSchemes:
1. system Default option (using system colors for light/dark mode switching)
2. fixed Using fixed theme colors (that will break light/dark mode switch)
2022-08-12 03:15:53 -04:00
2023-04-11 09:44:52 -04:00
--tweaks Specify versions for tweaks
1. [nord|dracula|gruvbox|everforest|catppuccin|all] (Nord/Dracula/Gruvbox/Everforet/Catppuccin/all) ColorSchemes version
2023-08-12 11:52:57 -04:00
2. black Blackness color version
3. rimless Remove the 1px border about windows and menus
4. normal Normal windows button style like gnome default theme (titlebuttons: max/min/close)
5. float Floating gnome-shell panel style
2021-12-09 08:53:04 -05:00
2024-05-12 17:36:14 -04:00
-r, --remove,
-u, --uninstall Uninstall/Remove installed themes or links
2021-12-09 08:53:04 -05:00
-h, --help Show help
EOF
}
install() {
local dest="${1}"
local name="${2}"
local theme="${3}"
local color="${4}"
local size="${5}"
2023-08-12 11:52:57 -04:00
local scheme="${6}"
2021-12-31 02:08:42 -05:00
local window="${7}"
2021-12-09 08:53:04 -05:00
2022-05-14 13:41:43 -04:00
[[ "${color}" == '-Light' ]] && local ELSE_LIGHT="${color}"
[[ "${color}" == '-Dark' ]] && local ELSE_DARK="${color}"
2021-12-09 08:53:04 -05:00
local THEME_DIR="${1}/${2}${3}${4}${5}${6}"
[[ -d "${THEME_DIR}" ]] && rm -rf "${THEME_DIR}"
echo "Installing '${THEME_DIR}'..."
theme_tweaks
mkdir -p "${THEME_DIR}"
echo "[Desktop Entry]" >> "${THEME_DIR}/index.theme"
echo "Type=X-GNOME-Metatheme" >> "${THEME_DIR}/index.theme"
echo "Name=${2}${3}${4}${5}${6}" >> "${THEME_DIR}/index.theme"
echo "Comment=An Flat Gtk+ theme based on Elegant Design" >> "${THEME_DIR}/index.theme"
echo "Encoding=UTF-8" >> "${THEME_DIR}/index.theme"
echo "" >> "${THEME_DIR}/index.theme"
echo "[X-GNOME-Metatheme]" >> "${THEME_DIR}/index.theme"
echo "GtkTheme=${2}${3}${4}${5}${6}" >> "${THEME_DIR}/index.theme"
echo "MetacityTheme=${2}${3}${4}${5}${6}" >> "${THEME_DIR}/index.theme"
echo "IconTheme=Tela-circle${ELSE_DARK:-}" >> "${THEME_DIR}/index.theme"
echo "CursorTheme=${2}-cursors" >> "${THEME_DIR}/index.theme"
echo "ButtonLayout=close,minimize,maximize:menu" >> "${THEME_DIR}/index.theme"
mkdir -p "${THEME_DIR}/gnome-shell"
cp -r "${SRC_DIR}/main/gnome-shell/pad-osd.css" "${THEME_DIR}/gnome-shell"
2022-04-22 08:19:01 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/gnome-shell/gnome-shell${color}.scss" "${THEME_DIR}/gnome-shell/gnome-shell.css"
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}/gtk-2.0"
2023-08-12 11:52:57 -04:00
# cp -r "${SRC_DIR}/main/gtk-2.0/gtkrc${theme}${ELSE_DARK:-}${scheme}" "${THEME_DIR}/gtk-2.0/gtkrc"
2021-12-09 08:53:04 -05:00
cp -r "${SRC_DIR}/main/gtk-2.0/common/"*'.rc' "${THEME_DIR}/gtk-2.0"
mkdir -p "${THEME_DIR}/gtk-3.0"
2022-04-22 08:19:01 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/gtk-3.0/gtk${color}.scss" "${THEME_DIR}/gtk-3.0/gtk.css"
2022-05-14 13:41:43 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/gtk-3.0/gtk-Dark.scss" "${THEME_DIR}/gtk-3.0/gtk-dark.css"
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}/gtk-4.0"
2022-04-22 08:19:01 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/gtk-4.0/gtk${color}.scss" "${THEME_DIR}/gtk-4.0/gtk.css"
2022-05-14 13:41:43 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/gtk-4.0/gtk-Dark.scss" "${THEME_DIR}/gtk-4.0/gtk-dark.css"
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}/cinnamon"
2022-04-22 08:19:01 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/cinnamon/cinnamon${color}.scss" "${THEME_DIR}/cinnamon/cinnamon.css"
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}/metacity-1"
2022-02-19 23:14:37 -05:00
cp -r "${SRC_DIR}/main/metacity-1/metacity-theme-3${window}.xml" "${THEME_DIR}/metacity-1/metacity-theme-3.xml"
cd "${THEME_DIR}/metacity-1" && ln -sf metacity-theme-3.xml metacity-theme-1.xml && ln -sf metacity-theme-3.xml metacity-theme-2.xml
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}/xfwm4"
2024-06-15 13:32:59 -04:00
cp -r "${SRC_DIR}/main/xfwm4/themerc" "${THEME_DIR}/xfwm4/themerc"
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}-hdpi/xfwm4"
2024-06-15 13:32:59 -04:00
cp -r "${SRC_DIR}/main/xfwm4/themerc" "${THEME_DIR}-hdpi/xfwm4/themerc"
2022-02-19 23:14:37 -05:00
sed -i "s/button_offset=6/button_offset=9/" "${THEME_DIR}-hdpi/xfwm4/themerc"
2021-12-09 08:53:04 -05:00
mkdir -p "${THEME_DIR}-xhdpi/xfwm4"
2024-06-15 13:32:59 -04:00
cp -r "${SRC_DIR}/main/xfwm4/themerc" "${THEME_DIR}-xhdpi/xfwm4/themerc"
2022-02-19 23:14:37 -05:00
sed -i "s/button_offset=6/button_offset=12/" "${THEME_DIR}-xhdpi/xfwm4/themerc"
2021-12-31 02:08:42 -05:00
2021-12-13 21:53:31 -05:00
mkdir -p "${THEME_DIR}/plank"
2022-05-14 13:41:43 -04:00
if [[ "$color" == '-Light' ]]; then
2024-04-12 14:34:30 -04:00
cp -r "${SRC_DIR}/main/plank/theme-Light${scheme}/"* "${THEME_DIR}/plank"
2021-12-13 21:53:31 -05:00
else
2024-04-12 14:34:30 -04:00
cp -r "${SRC_DIR}/main/plank/theme-Dark${scheme}/"* "${THEME_DIR}/plank"
2021-12-13 21:53:31 -05:00
fi
2021-12-09 08:53:04 -05:00
}
themes=()
colors=()
sizes=()
2022-09-21 11:46:13 -04:00
lcolors=()
2023-08-12 11:52:57 -04:00
schemes=()
2021-12-09 08:53:04 -05:00
while [[ $# -gt 0 ]]; do
case "${1}" in
-d|--dest)
dest="${2}"
if [[ ! -d "${dest}" ]]; then
2024-05-12 17:36:14 -04:00
echo -e "\nDestination directory does not exist. Let's make a new one..."
2021-12-09 08:53:04 -05:00
mkdir -p ${dest}
fi
shift 2
;;
-n|--name)
name="${2}"
shift 2
;;
2022-11-01 11:05:07 -04:00
-r|--remove|-u|--uninstall)
uninstall="true"
shift
;;
-l|--libadwaita)
libadwaita="true"
shift
2024-05-12 17:36:14 -04:00
for type in "${@}"; do
case "${type}" in
system)
echo -e "\nUse system default colors for light/dark mode switch."
shift
;;
fixed)
colortype='fixed'
echo -e "\nUse fixed theme colors but that will break light/dark mode switch."
shift
;;
-*|--*)
break
;;
*)
echo -e "\nERROR: Unrecognized type variant '$1'."
echo -e "\nTry '$0 --help' for more information."
exit 1
;;
esac
done
2022-11-01 11:05:07 -04:00
;;
2021-12-09 08:53:04 -05:00
-c|--color)
shift
for color in "${@}"; do
case "${color}" in
standard)
colors+=("${COLOR_VARIANTS[0]}")
2022-09-21 11:46:13 -04:00
lcolors+=("${COLOR_VARIANTS[0]}")
2021-12-09 08:53:04 -05:00
shift
;;
light)
colors+=("${COLOR_VARIANTS[1]}")
2022-09-21 11:46:13 -04:00
lcolors+=("${COLOR_VARIANTS[1]}")
2021-12-09 08:53:04 -05:00
shift
;;
dark)
colors+=("${COLOR_VARIANTS[2]}")
2022-09-21 11:46:13 -04:00
lcolors+=("${COLOR_VARIANTS[2]}")
2021-12-09 08:53:04 -05:00
shift
;;
-*|--*)
break
;;
*)
2024-05-12 17:36:14 -04:00
echo -e "\nERROR: Unrecognized color variant '$1'."
echo -e "\nTry '$0 --help' for more information."
2021-12-09 08:53:04 -05:00
exit 1
;;
esac
done
;;
-t|--theme)
accent='true'
shift
for variant in "$@"; do
case "$variant" in
default)
themes+=("${THEME_VARIANTS[0]}")
shift
;;
purple)
themes+=("${THEME_VARIANTS[1]}")
shift
;;
pink)
themes+=("${THEME_VARIANTS[2]}")
shift
;;
red)
themes+=("${THEME_VARIANTS[3]}")
shift
;;
orange)
themes+=("${THEME_VARIANTS[4]}")
shift
;;
yellow)
themes+=("${THEME_VARIANTS[5]}")
shift
;;
green)
themes+=("${THEME_VARIANTS[6]}")
shift
;;
teal)
themes+=("${THEME_VARIANTS[7]}")
shift
;;
grey)
themes+=("${THEME_VARIANTS[8]}")
shift
;;
all)
themes+=("${THEME_VARIANTS[@]}")
shift
;;
-*)
break
;;
*)
2024-05-12 17:36:14 -04:00
echo -e "\nERROR: Unrecognized theme variant '$1'."
echo -e "\nTry '$0 --help' for more information."
2021-12-09 08:53:04 -05:00
exit 1
;;
esac
done
;;
-s|--size)
shift
for variant in "$@"; do
case "$variant" in
standard)
sizes+=("${SIZE_VARIANTS[0]}")
shift
;;
compact)
sizes+=("${SIZE_VARIANTS[1]}")
compact='true'
shift
;;
-*)
break
;;
*)
2024-05-12 17:36:14 -04:00
echo -e "\nERROR: Unrecognized size variant '${1:-}'."
echo -e "\nTry '$0 --help' for more information."
2021-12-09 08:53:04 -05:00
exit 1
;;
esac
done
;;
--tweaks)
shift
for variant in $@; do
case "$variant" in
nord)
2023-08-12 11:52:57 -04:00
colorscheme='true'
schemes+=("${SCHEME_VARIANTS[1]}")
2024-05-12 17:36:14 -04:00
echo -e "\nNord ColorScheme version! ..."
2022-02-15 03:51:51 -05:00
shift
;;
dracula)
2023-08-12 11:52:57 -04:00
colorscheme='true'
schemes+=("${SCHEME_VARIANTS[2]}")
2024-05-12 17:36:14 -04:00
echo -e "\nDracula ColorScheme version! ..."
2021-12-09 08:53:04 -05:00
shift
;;
2023-04-11 09:42:30 -04:00
gruvbox)
2023-08-12 11:52:57 -04:00
colorscheme='true'
schemes+=("${SCHEME_VARIANTS[3]}")
2024-05-12 17:36:14 -04:00
echo -e "\nGruvbox ColorScheme version! ..."
2023-04-11 09:42:30 -04:00
shift
;;
2024-02-22 13:03:48 -05:00
everforest)
colorscheme='true'
schemes+=("${SCHEME_VARIANTS[4]}")
2024-05-12 17:36:14 -04:00
echo -e "\nEverforest ColorScheme version! ..."
2024-02-22 13:03:48 -05:00
shift
;;
catppuccin)
colorscheme='true'
schemes+=("${SCHEME_VARIANTS[5]}")
echo -e "\nCatppuccin ColorScheme version! ..."
shift
;;
2023-08-12 11:52:57 -04:00
all)
colorscheme='true'
schemes+=("${SCHEME_VARIANTS[@]}")
shift
;;
2021-12-09 08:53:04 -05:00
black)
blackness="true"
2024-05-12 17:36:14 -04:00
echo -e "\nBlackness version! ..."
2021-12-09 08:53:04 -05:00
shift
;;
rimless)
rimless="true"
2024-05-12 17:36:14 -04:00
echo -e "\nRimless version! ..."
2021-12-09 08:53:04 -05:00
shift
;;
2021-12-10 11:11:10 -05:00
normal)
normal="true"
2022-05-14 13:41:43 -04:00
window="-Normal"
2024-05-12 17:36:14 -04:00
echo -e "\nNormal window button version! ..."
2021-12-10 11:11:10 -05:00
shift
;;
2023-05-29 23:01:33 -04:00
float)
float="true"
2024-05-12 17:36:14 -04:00
echo -e "\nInstall Floating Gnome-Shell Panel version! ..."
2023-05-29 23:01:33 -04:00
shift
;;
2021-12-09 08:53:04 -05:00
-*)
break
;;
*)
2024-05-12 17:36:14 -04:00
echo -e "\nERROR: Unrecognized tweaks variant '$1'."
echo -e "\nTry '$0 --help' for more information."
2021-12-09 08:53:04 -05:00
exit 1
;;
esac
done
;;
-h|--help)
usage
exit 0
;;
*)
2024-05-12 17:36:14 -04:00
echo -e "\nERROR: Unrecognized installation option '$1'."
echo -e "\nTry '$0 --help' for more information."
2021-12-09 08:53:04 -05:00
exit 1
;;
esac
done
if [[ "${#themes[@]}" -eq 0 ]] ; then
themes=("${THEME_VARIANTS[0]}")
fi
if [[ "${#colors[@]}" -eq 0 ]] ; then
colors=("${COLOR_VARIANTS[@]}")
fi
2022-09-21 11:46:13 -04:00
if [[ "${#lcolors[@]}" -eq 0 ]] ; then
lcolors=("${COLOR_VARIANTS[1]}")
fi
2021-12-09 08:53:04 -05:00
if [[ "${#sizes[@]}" -eq 0 ]] ; then
sizes=("${SIZE_VARIANTS[0]}")
fi
2023-08-12 11:52:57 -04:00
if [[ "${#schemes[@]}" -eq 0 ]] ; then
schemes=("${SCHEME_VARIANTS[0]}")
fi
2021-12-09 08:53:04 -05:00
# Check command avalibility
function has_command() {
command -v $1 > /dev/null
}
# Install needed packages
install_package() {
2023-10-19 10:23:31 -04:00
if ! has_command sassc; then
2021-12-09 08:53:04 -05:00
echo sassc needs to be installed to generate the css.
if has_command zypper; then
sudo zypper in sassc
2024-04-29 08:31:06 -04:00
elif has_command apt; then
sudo apt install sassc
2021-12-09 08:53:04 -05:00
elif has_command apt-get; then
sudo apt-get install sassc
elif has_command dnf; then
sudo dnf install sassc
2024-04-29 08:31:06 -04:00
elif has_command yum; then
sudo yum install sassc
2021-12-09 08:53:04 -05:00
elif has_command pacman; then
sudo pacman -S --noconfirm sassc
fi
fi
}
2022-05-14 13:41:43 -04:00
tweaks_temp() {
cp -rf "${SRC_DIR}/sass/_tweaks.scss" "${SRC_DIR}/sass/_tweaks-temp.scss"
2021-12-09 08:53:04 -05:00
}
compact_size() {
sed -i "/\$compact:/s/false/true/" "${SRC_DIR}/sass/_tweaks-temp.scss"
2021-12-09 08:53:04 -05:00
}
2023-08-12 11:52:57 -04:00
color_schemes() {
if [[ "$scheme" != '' ]]; then
case "$scheme" in
-Nord)
scheme_color='nord'
;;
-Dracula)
scheme_color='dracula'
;;
-Gruvbox)
scheme_color='gruvbox'
;;
2024-02-22 13:03:48 -05:00
-Everforest)
scheme_color='everforest'
;;
-Catppuccin)
scheme_color='catppuccin'
;;
2023-08-12 11:52:57 -04:00
esac
sed -i "/\@import/s/color-palette-default/color-palette-${scheme_color}/" "${SRC_DIR}/sass/_tweaks-temp.scss"
sed -i "/\$colorscheme:/s/default/${scheme_color}/" "${SRC_DIR}/sass/_tweaks-temp.scss"
fi
2023-04-11 09:42:30 -04:00
}
2024-05-12 17:36:14 -04:00
color_type() {
sed -i "/\$colortype:/s/system/fixed/" "${SRC_DIR}/sass/_tweaks-temp.scss"
}
2021-12-09 08:53:04 -05:00
blackness_color() {
sed -i "/\$blackness:/s/false/true/" "${SRC_DIR}/sass/_tweaks-temp.scss"
2021-12-09 08:53:04 -05:00
}
border_rimless() {
sed -i "/\$rimless:/s/false/true/" "${SRC_DIR}/sass/_tweaks-temp.scss"
2021-12-09 08:53:04 -05:00
}
2021-12-10 11:11:10 -05:00
normal_winbutton() {
sed -i "/\$window_button:/s/mac/normal/" "${SRC_DIR}/sass/_tweaks-temp.scss"
2021-12-10 11:11:10 -05:00
}
2023-05-29 23:01:33 -04:00
float_panel() {
sed -i "/\$float:/s/false/true/" "${SRC_DIR}/sass/_tweaks-temp.scss"
}
2022-04-22 08:19:01 -04:00
gnome_shell_version() {
cp -rf "${SRC_DIR}/sass/gnome-shell/_common.scss" "${SRC_DIR}/sass/gnome-shell/_common-temp.scss"
2022-05-14 13:41:43 -04:00
sed -i "/\widgets/s/40-0/${GS_VERSION}/" "${SRC_DIR}/sass/gnome-shell/_common-temp.scss"
2022-04-22 08:19:01 -04:00
2024-04-30 20:52:55 -04:00
if [[ "${GS_VERSION}" != '40-0' && "${GS_VERSION}" != '42-0' && "${GS_VERSION}" != '44-0' ]]; then
sed -i "/\extensions/s/40-0/${GS_VERSION}/" "${SRC_DIR}/sass/gnome-shell/_common-temp.scss"
2022-04-22 08:19:01 -04:00
fi
}
2021-12-09 08:53:04 -05:00
theme_color() {
if [[ "$theme" != '' ]]; then
case "$theme" in
2022-05-14 13:41:43 -04:00
-Purple)
2021-12-09 08:53:04 -05:00
theme_color='purple'
;;
2022-05-14 13:41:43 -04:00
-Pink)
2021-12-09 08:53:04 -05:00
theme_color='pink'
;;
2022-05-14 13:41:43 -04:00
-Red)
2021-12-09 08:53:04 -05:00
theme_color='red'
;;
2022-05-14 13:41:43 -04:00
-Orange)
2021-12-09 08:53:04 -05:00
theme_color='orange'
;;
2022-05-14 13:41:43 -04:00
-Yellow)
2021-12-09 08:53:04 -05:00
theme_color='yellow'
;;
2022-05-14 13:41:43 -04:00
-Green)
2021-12-09 08:53:04 -05:00
theme_color='green'
;;
2022-05-14 13:41:43 -04:00
-Teal)
2021-12-09 08:53:04 -05:00
theme_color='teal'
;;
2022-05-14 13:41:43 -04:00
-Grey)
2021-12-09 08:53:04 -05:00
theme_color='grey'
;;
esac
sed -i "/\$theme:/s/default/${theme_color}/" "${SRC_DIR}/sass/_tweaks-temp.scss"
2021-12-09 08:53:04 -05:00
fi
}
theme_tweaks() {
2023-08-12 11:52:57 -04:00
if [[ "$accent" = "true" || "$colorscheme" = "true" ]]; then
tweaks_temp
2021-12-09 08:53:04 -05:00
fi
2023-08-12 11:52:57 -04:00
if [[ "$accent" = "true" ]]; then
theme_color
2021-12-09 08:53:04 -05:00
fi
2023-08-12 11:52:57 -04:00
if [[ "$compact" = "true" ]]; then
compact_size
2022-02-15 03:51:51 -05:00
fi
2024-04-28 14:02:45 -04:00
2024-05-12 17:36:14 -04:00
if [[ "$colortype" = "fixed" ]] ; then
color_type
fi
2023-08-12 11:52:57 -04:00
if [[ "$colorscheme" = "true" ]] ; then
color_schemes
2023-04-11 09:42:30 -04:00
fi
2023-08-12 11:52:57 -04:00
if [[ "$blackness" = "true" ]]; then
2021-12-09 08:53:04 -05:00
blackness_color
fi
2023-08-12 11:52:57 -04:00
if [[ "$rimless" = "true" ]]; then
2021-12-09 08:53:04 -05:00
border_rimless
fi
2021-12-10 11:11:10 -05:00
2023-08-12 11:52:57 -04:00
if [[ "$normal" = "true" ]]; then
2021-12-10 11:11:10 -05:00
normal_winbutton
fi
2023-05-29 23:01:33 -04:00
2023-08-12 11:52:57 -04:00
if [[ "$float" = "true" ]]; then
2023-05-29 23:01:33 -04:00
float_panel
fi
2021-12-09 08:53:04 -05:00
}
2024-05-11 12:28:32 -04:00
uninstall_libadwaita() {
2024-04-28 14:02:45 -04:00
rm -rf "${HOME}/.config/gtk-4.0/"{assets,windows-assets,gtk.css,gtk-dark.css,gtk-Light.css,gtk-Dark.css}
2022-08-12 03:15:53 -04:00
}
2022-08-02 13:54:49 -04:00
link_libadwaita() {
local dest="${1}"
local name="${2}"
local theme="${3}"
local color="${4}"
local size="${5}"
2023-08-12 11:52:57 -04:00
local scheme="${6}"
2022-08-02 13:54:49 -04:00
local THEME_DIR="${1}/${2}${3}${4}${5}${6}"
2022-09-21 21:04:33 -04:00
rm -rf "${HOME}/.config/gtk-4.0/"{assets,gtk.css,gtk-dark.css}
2024-05-12 17:36:14 -04:00
echo -e "\nLink '${THEME_DIR}/gtk-4.0' to '${HOME}/.config/gtk-4.0' for libadwaita...\n"
2022-08-02 13:54:49 -04:00
mkdir -p "${HOME}/.config/gtk-4.0"
ln -sf "${THEME_DIR}/gtk-4.0/assets" "${HOME}/.config/gtk-4.0/assets"
ln -sf "${THEME_DIR}/gtk-4.0/gtk.css" "${HOME}/.config/gtk-4.0/gtk.css"
ln -sf "${THEME_DIR}/gtk-4.0/gtk-dark.css" "${HOME}/.config/gtk-4.0/gtk-dark.css"
}
2024-05-11 12:28:32 -04:00
libadwaita_theme() {
2024-04-28 14:02:45 -04:00
local dest="${1}"
local name="${2}"
local theme="${3}"
local color="${4}"
local size="${5}"
local scheme="${6}"
theme_tweaks
2024-04-24 06:03:05 -04:00
rm -rf "${HOME}/.config/gtk-4.0/"{assets,gtk.css,gtk-dark.css}
2024-05-12 17:36:14 -04:00
echo -e "\nInstalling ${2}${3}${4}${5}${6} theme into '${HOME}/.config/gtk-4.0' for libadwaita..."
2024-04-24 06:03:05 -04:00
mkdir -p "${HOME}/.config/gtk-4.0"
cp -r "${SRC_DIR}/assets/gtk/assets" "${HOME}/.config/gtk-4.0"
cp -r "${SRC_DIR}/assets/gtk/symbolics/"*'.svg' "${HOME}/.config/gtk-4.0/assets"
2024-04-28 14:02:45 -04:00
2024-05-12 17:36:14 -04:00
if [[ "$colorscheme" = "true" || "$blackness" = "true" || "$colortype" = "fixed" ]] ; then
2024-04-28 14:02:45 -04:00
sassc $SASSC_OPT "${SRC_DIR}/main/libadwaita/libadwaita${color}.scss" "${HOME}/.config/gtk-4.0/gtk.css"
else
sassc $SASSC_OPT "${SRC_DIR}/main/libadwaita/libadwaita-Light.scss" "${HOME}/.config/gtk-4.0/gtk.css"
fi
2024-04-24 06:03:05 -04:00
}
2022-08-02 13:54:49 -04:00
link_theme() {
for theme in "${themes[@]}"; do
2022-09-21 11:46:13 -04:00
for color in "${lcolors[@]}"; do
2022-08-02 13:54:49 -04:00
for size in "${sizes[@]}"; do
2023-08-12 11:52:57 -04:00
for scheme in "${schemes[@]}"; do
link_libadwaita "${dest:-$DEST_DIR}" "${name:-$THEME_NAME}" "$theme" "$color" "$size" "$scheme"
done
2022-08-02 13:54:49 -04:00
done
done
done
}
2024-05-11 12:28:32 -04:00
install_libadwaita() {
2024-04-28 14:02:45 -04:00
for theme in "${themes[@]}"; do
for color in "${lcolors[@]}"; do
for size in "${sizes[@]}"; do
for scheme in "${schemes[@]}"; do
2024-05-11 12:28:32 -04:00
libadwaita_theme "${dest:-$DEST_DIR}" "${name:-$THEME_NAME}" "$theme" "$color" "$size" "$scheme"
2024-04-28 14:02:45 -04:00
done
done
done
done
}
2021-12-09 08:53:04 -05:00
install_theme() {
for theme in "${themes[@]}"; do
for color in "${colors[@]}"; do
for size in "${sizes[@]}"; do
2023-08-12 11:52:57 -04:00
for scheme in "${schemes[@]}"; do
install "${dest:-$DEST_DIR}" "${name:-$THEME_NAME}" "$theme" "$color" "$size" "$scheme" "$window"
make_gtkrc "${dest:-$DEST_DIR}" "${name:-$THEME_NAME}" "$theme" "$color" "$size" "$scheme" "$window"
2024-04-12 14:34:30 -04:00
make_assets "${dest:-$DEST_DIR}" "${name:-$THEME_NAME}" "$theme" "$color" "$size" "$scheme" "$window"
2023-08-12 11:52:57 -04:00
done
2021-12-09 08:53:04 -05:00
done
done
done
2022-02-18 07:45:21 -05:00
2023-08-24 00:58:38 -04:00
if (command -v xfce4-popup-whiskermenu &> /dev/null) && $(sed -i "s|.*menu-opacity=.*|menu-opacity=95|" "$HOME/.config/xfce4/panel/whiskermenu"*".rc" &> /dev/null); then
2023-06-21 01:05:46 -04:00
sed -i "s|.*menu-opacity=.*|menu-opacity=95|" "$HOME/.config/xfce4/panel/whiskermenu"*".rc"
2023-03-21 06:11:04 -04:00
fi
if (pgrep xfce4-session &> /dev/null); then
xfce4-panel -r
2022-02-18 07:45:21 -05:00
fi
2021-12-09 08:53:04 -05:00
}
2022-08-12 03:15:53 -04:00
uninstall() {
local dest="${1}"
local name="${2}"
local theme="${3}"
local color="${4}"
local size="${5}"
2023-08-12 11:52:57 -04:00
local scheme="${6}"
2022-08-12 03:15:53 -04:00
local THEME_DIR="${1}/${2}${3}${4}${5}${6}"
if [[ -d "${THEME_DIR}" ]]; then
echo -e "Uninstall ${THEME_DIR}... "
rm -rf "${THEME_DIR}"
fi
}
uninstall_theme() {
for theme in "${themes[@]}"; do
for color in "${colors[@]}"; do
for size in "${sizes[@]}"; do
2023-08-12 11:52:57 -04:00
uninstall "${dest:-$DEST_DIR}" "${name:-$THEME_NAME}" "$theme" "$color" "$size" "$scheme"
2022-08-12 03:15:53 -04:00
done
done
done
}
if [[ "$uninstall" == 'true' ]]; then
if [[ "$libadwaita" == 'true' ]]; then
2024-04-28 14:02:45 -04:00
echo -e "\nUninstall libadwaita theme from ${HOME}/.config/gtk-4.0 ..."
2024-05-11 12:28:32 -04:00
uninstall_libadwaita
2022-08-12 03:15:53 -04:00
else
2024-05-11 12:28:32 -04:00
echo && uninstall_theme && uninstall_libadwaita
2022-08-12 03:15:53 -04:00
fi
else
2024-05-12 17:36:14 -04:00
install_package && tweaks_temp
gnome_shell_version && echo && install_theme
2024-04-28 14:02:45 -04:00
2022-11-01 11:05:07 -04:00
if [[ "$libadwaita" == 'true' ]]; then
2024-05-11 12:28:32 -04:00
uninstall_libadwaita && install_libadwaita
2022-11-01 11:05:07 -04:00
fi
2022-08-12 03:15:53 -04:00
fi
2021-12-09 08:53:04 -05:00
echo
echo Done.