This commit is contained in:
vinceliuice
2022-08-12 15:15:53 +08:00
parent eb2f59f89b
commit 40560a8031
3 changed files with 91 additions and 30 deletions

View File

@@ -33,6 +33,7 @@ Run the following commands in the terminal:
-t, --theme VARIANT... Specify theme color variant(s) [default|purple|pink|red|orange|yellow|green|teal|grey|all] (Default: blue) -t, --theme VARIANT... Specify theme color variant(s) [default|purple|pink|red|orange|yellow|green|teal|grey|all] (Default: blue)
-c, --color VARIANT... Specify color variant(s) [standard|light|dark] (Default: All variants) -c, --color VARIANT... Specify color variant(s) [standard|light|dark] (Default: All variants)
-s, --size VARIANT... Specify size variant [standard|compact] (Default: standard variant) -s, --size VARIANT... Specify size variant [standard|compact] (Default: standard variant)
-u, --uninstall Uninstall theme variant [theme|libadwaita] (Default: theme variant)
--tweaks Specify versions for tweaks [nord|dracula|black|rimless|normal] (only nord and dracula can not mix use with!) --tweaks Specify versions for tweaks [nord|dracula|black|rimless|normal] (only nord and dracula can not mix use with!)
1. nord: Nord ColorScheme version 1. nord: Nord ColorScheme version
2. dracula Dracula ColorScheme version 2. dracula Dracula ColorScheme version

View File

@@ -57,6 +57,8 @@ OPTIONS:
-s, --size VARIANT Specify size variant [standard|compact] (Default: standard variant) -s, --size VARIANT Specify size variant [standard|compact] (Default: standard variant)
-u, --uninstall Uninstall theme variant [theme|libadwaita] (Default: theme variant)
--tweaks Specify versions for tweaks [nord|dracula|black|rimless|normal] (only nord and dracula can not mix use with!) --tweaks Specify versions for tweaks [nord|dracula|black|rimless|normal] (only nord and dracula can not mix use with!)
1. nord: Nord ColorScheme version 1. nord: Nord ColorScheme version
2. dracula Dracula ColorScheme version 2. dracula Dracula ColorScheme version
@@ -294,6 +296,29 @@ while [[ $# -gt 0 ]]; do
esac esac
done done
;; ;;
-u|--uninstall)
uninstall="true"
shift
for variant in "$@"; do
case "$variant" in
theme)
libadwaita="false"
;;
libadwaita)
libadwaita="true"
shift
;;
-*)
break
;;
*)
echo "ERROR: Unrecognized uninstall variant '${1:-}'."
echo "Try '$0 --help' for more information."
exit 1
;;
esac
done
;;
--tweaks) --tweaks)
shift shift
for variant in $@; do for variant in $@; do
@@ -301,29 +326,29 @@ while [[ $# -gt 0 ]]; do
nord) nord)
nord="true" nord="true"
ctype="-Nord" ctype="-Nord"
echo -e "Install Nord ColorScheme version! ..." echo -e "Nord ColorScheme version! ..."
shift shift
;; ;;
dracula) dracula)
dracula="true" dracula="true"
ctype="-Dracula" ctype="-Dracula"
echo -e "Install Dracula ColorScheme version! ..." echo -e "Dracula ColorScheme version! ..."
shift shift
;; ;;
black) black)
blackness="true" blackness="true"
echo -e "Install Blackness version! ..." echo -e "Blackness version! ..."
shift shift
;; ;;
rimless) rimless)
rimless="true" rimless="true"
echo -e "Install Rimless version! ..." echo -e "Rimless version! ..."
shift shift
;; ;;
normal) normal)
normal="true" normal="true"
window="-Normal" window="-Normal"
echo -e "Install Normal window button version! ..." echo -e "Normal window button version! ..."
shift shift
;; ;;
-*) -*)
@@ -487,6 +512,12 @@ theme_tweaks() {
fi fi
} }
uninstall_link() {
[[ -L "${HOME}/.config/gtk-4.0/assets" ]] && rm -rf "${HOME}/.config/gtk-4.0/assets" && echo -e "\nUninstall ${HOME}/.config/gtk-4.0/assets link ..."
[[ -L "${HOME}/.config/gtk-4.0/gtk.css" ]] && rm -rf "${HOME}/.config/gtk-4.0/gtk.css" && echo -e "Uninstall ${HOME}/.config/gtk-4.0/gtk.css link ..."
[[ -L "${HOME}/.config/gtk-4.0/gtk-dark.css" ]] && rm -rf "${HOME}/.config/gtk-4.0/gtk-dark.css" && echo -e "Uninstall ${HOME}/.config/gtk-4.0/gtk-dark.css link ..."
}
link_libadwaita() { link_libadwaita() {
local dest="${1}" local dest="${1}"
local name="${2}" local name="${2}"
@@ -497,14 +528,9 @@ link_libadwaita() {
local THEME_DIR="${1}/${2}${3}${4}${5}${6}" local THEME_DIR="${1}/${2}${3}${4}${5}${6}"
[[ -L "${HOME}/.config/gtk-4.0/assets" ]] && rm -rf "${HOME}/.config/gtk-4.0/assets"
[[ -L "${HOME}/.config/gtk-4.0/gtk.css" ]] && rm -rf "${HOME}/.config/gtk-4.0/gtk.css"
[[ -L "${HOME}/.config/gtk-4.0/gtk-dark.css" ]] && rm -rf "${HOME}/.config/gtk-4.0/gtk-dark.css"
echo -e "\nLink '$THEME_DIR/gtk-4.0' to '${HOME}/.config/gtk-4.0' for libadwaita..." echo -e "\nLink '$THEME_DIR/gtk-4.0' to '${HOME}/.config/gtk-4.0' for libadwaita..."
mkdir -p "${HOME}/.config/gtk-4.0" mkdir -p "${HOME}/.config/gtk-4.0"
rm -rf "${HOME}/.config/gtk-4.0/"{assets,gtk.css,gtk-dark.css}
ln -sf "${THEME_DIR}/gtk-4.0/assets" "${HOME}/.config/gtk-4.0/assets" 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.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" ln -sf "${THEME_DIR}/gtk-4.0/gtk-dark.css" "${HOME}/.config/gtk-4.0/gtk-dark.css"
@@ -521,15 +547,15 @@ link_theme() {
} }
clean() { clean() {
local dest=${1} local dest="${1}"
local name=${2} local name="${2}"
local theme=${3} local theme="${3}"
local color=${4} local color="${4}"
local size=${5} local size="${5}"
local type=${6} local type="${6}"
local screen=${7} local screen="${7}"
local THEME_DIR=${dest}/${name}${theme}${color}${size}${type}${screen} local THEME_DIR="${1}/${2}${3}${4}${5}${6}${7}"
if [[ ${theme} == '' && ${color} == '' && ${size} == '' && ${type} == '' ]]; then if [[ ${theme} == '' && ${color} == '' && ${size} == '' && ${type} == '' ]]; then
cleantheme='none' cleantheme='none'
@@ -568,7 +594,41 @@ install_theme() {
fi fi
} }
uninstall() {
local dest="${1}"
local name="${2}"
local theme="${3}"
local color="${4}"
local size="${5}"
local ctype="${6}"
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
uninstall "${dest:-$DEST_DIR}" "${_name:-$THEME_NAME}" "$theme" "$color" "$size" "$ctype"
done
done
done
}
if [[ "$uninstall" == 'true' ]]; then
if [[ "$libadwaita" == 'true' ]]; then
uninstall_link
else
echo && uninstall_theme && uninstall_link
fi
else
clean_theme && install_package && tweaks_temp && gnome_shell_version && install_theme && link_theme clean_theme && install_package && tweaks_temp && gnome_shell_version && install_theme && link_theme
fi
echo echo
echo Done. echo Done.

View File

@@ -8,8 +8,8 @@ INDEX="assets.txt"
./make-assets.sh ./make-assets.sh
for theme in '' '-purple' '-pink' '-red' '-orange' '-yellow' '-green' '-grey' '-teal'; do for theme in '' '-Purple' '-Pink' '-Red' '-Orange' '-Yellow' '-Green' '-Teal' '-Grey'; do
for type in '' '-nord' '-dracula'; do for type in '' '-Nord' '-Dracula'; do
ASSETS_DIR="assets${theme}${type}" ASSETS_DIR="assets${theme}${type}"
SRC_FILE="assets${theme}${type}.svg" SRC_FILE="assets${theme}${type}.svg"
@@ -57,8 +57,8 @@ done
done done
done done
for theme in '' '-purple' '-pink' '-red' '-orange' '-yellow' '-green' '-teal' '-grey'; do for theme in '' '-Purple' '-Pink' '-Red' '-Orange' '-Yellow' '-Green' '-Teal' '-Grey'; do
for type in '' '-nord' '-dracula'; do for type in '' '-Nord' '-Dracula'; do
if [[ "${theme}" == '' && "${type}" == '' ]]; then if [[ "${theme}" == '' && "${type}" == '' ]]; then
echo "keep assets.svg file..." echo "keep assets.svg file..."
else else