1
0
Fork 0
mirror of https://github.com/vinceliuice/WhiteSur-icon-theme.git synced 2024-11-22 05:40:09 +00:00
This commit is contained in:
Vince 2021-06-25 12:09:48 +08:00
parent 72c65d0075
commit 7333dc7035
3 changed files with 44 additions and 56 deletions

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

@ -1,4 +1,4 @@
#! /usr/bin/env bash #!/bin/bash
ROOT_UID=0 ROOT_UID=0
DEST_DIR= DEST_DIR=
@ -10,43 +10,26 @@ else
DEST_DIR="$HOME/.local/share/icons" DEST_DIR="$HOME/.local/share/icons"
fi fi
SRC_DIR=$(cd $(dirname $0) && pwd) SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
THEME_NAME=WhiteSur THEME_NAME=WhiteSur
COLOR_VARIANTS=('' '-dark') COLOR_VARIANTS=('' '-dark')
THEME_VARIANTS=('' '-purple' '-pink' '-red' '-orange' '-yellow' '-green' '-grey') THEME_VARIANTS=('' '-purple' '-pink' '-red' '-orange' '-yellow' '-green' '-grey')
usage() { usage() {
printf "%s\n" "Usage: $0 [OPTIONS...]" cat << EOF
printf "\n%s\n" "OPTIONS:" Usage: $0 [OPTION]...
printf " %-25s%s\n" "-d, --dest DIR" "Specify theme destination directory (Default: ${DEST_DIR})"
printf " %-25s%s\n" "-n, --name NAME" "Specify theme name (Default: ${THEME_NAME})"
printf " %-25s%s\n" "-t, --theme VARIANTS" "Specify folder color [default|purple|pink|red|orange|yellow|green|grey|all] (Default: MacOS blue)"
printf " %-25s%s\n" "-a, --alternative" "Install alternative icons for software center and file-manager"
printf " %-25s%s\n" "-h, --help" "Show this help"
}
# change the name of software and file-manager to use the alternative OPTIONS:
alternative() { -d, --dest DIR Specify destination directory (Default: $DEST_DIR)
local dir="${SRC_DIR}/src/apps/scalable" -n, --name NAME Specify theme name (Default: $THEME_NAME)
if [[ ${1} == 'unset' ]]; then -t, --theme VARIANT Specify theme color variant(s) [default|purple|pink|red|orange|yellow|green|grey|all] (Default: blue)
# Software -c, --color VARIANT Specify color variant(s) [standard|light|dark] (Default: All variants)s)
mv ${dir}/softwarecenter.svg ${dir}/softwarecenter-alternative.svg -a, --alternative Install alternative icons for software center and file-manager
mv ${dir}/softwarecenter-old.svg ${dir}/softwarecenter.svg -h, --help Show help
# File-manager EOF
mv ${dir}/file-manager.svg ${dir}/file-manager-alternative.svg
mv ${dir}/file-manager-old.svg ${dir}/file-manager.svg
else
# Software
mv ${dir}/softwarecenter.svg ${dir}/softwarecenter-old.svg
mv ${dir}/softwarecenter-alternative.svg ${dir}/softwarecenter.svg
# File-manager
mv ${dir}/file-manager.svg ${dir}/file-manager-old.svg
mv ${dir}/file-manager-alternative.svg ${dir}/file-manager.svg
fi
} }
install() { install() {
local dest=${1} local dest=${1}
local name=${2} local name=${2}
@ -71,14 +54,18 @@ install() {
cp -r ${SRC_DIR}/src/{actions,animations,apps,categories,devices,emblems,mimes,places} ${THEME_DIR} cp -r ${SRC_DIR}/src/{actions,animations,apps,categories,devices,emblems,mimes,places} ${THEME_DIR}
cp -r ${SRC_DIR}/src/status/{16,22,24,32,symbolic} ${THEME_DIR}/status cp -r ${SRC_DIR}/src/status/{16,22,24,32,symbolic} ${THEME_DIR}/status
cp -r ${SRC_DIR}/links/{actions,apps,categories,devices,emblems,mimes,places,status} ${THEME_DIR} cp -r ${SRC_DIR}/links/{actions,apps,categories,devices,emblems,mimes,places,status} ${THEME_DIR}
if [[ $DESKTOP_SESSION == '/usr/share/xsessions/budgie-desktop' ]]; then if [[ $DESKTOP_SESSION == '/usr/share/xsessions/budgie-desktop' ]]; then
cp -r ${SRC_DIR}/src/status/symbolic-budgie/*.svg ${THEME_DIR}/status/symbolic cp -r ${SRC_DIR}/src/status/symbolic-budgie/*.svg ${THEME_DIR}/status/symbolic
fi fi
fi
if [[ ${color} == '' && ${theme} != '' ]]; then if [[ ${alternative:-} == 'true' ]]; then
cp -r ${SRC_DIR}/colors/color${theme}/*.svg ${THEME_DIR}/places/scalable cp -r ${SRC_DIR}/alternative/apps/*.svg ${THEME_DIR}/apps/scalable
fi
if [[ ${theme} != '' ]]; then
cp -r ${SRC_DIR}/colors/color${theme}/*.svg ${THEME_DIR}/places/scalable
fi
fi fi
if [[ ${color} == '-dark' ]]; then if [[ ${color} == '-dark' ]]; then
@ -125,6 +112,7 @@ install() {
ln -s ../../${name}${theme}/status/32 ${name}${theme}-dark/status/32 ln -s ../../${name}${theme}/status/32 ${name}${theme}-dark/status/32
fi fi
(
cd ${THEME_DIR} cd ${THEME_DIR}
ln -sf actions actions@2x ln -sf actions actions@2x
ln -sf animations animations@2x ln -sf animations animations@2x
@ -135,25 +123,27 @@ install() {
ln -sf mimes mimes@2x ln -sf mimes mimes@2x
ln -sf places places@2x ln -sf places places@2x
ln -sf status status@2x ln -sf status status@2x
)
cd ${dest} gtk-update-icon-cache ${THEME_DIR}
gtk-update-icon-cache ${name}${theme}${color}
} }
while [[ $# -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
case "${1}" in case "${1:-}" in
-d|--dest) -d|--dest)
dest="${2}" dest="$2"
if [[ ! -d "${dest}" ]]; then mkdir -p "$dest"
echo "ERROR: Destination directory does not exist."
exit 1
fi
shift 2 shift 2
;; ;;
-n|--name) -n|--name)
name="${2}" name="${2}"
shift 2 shift 2
;; ;;
-a|--alternative)
alternative='true'
echo "Installing 'alternative' version..."
shift
;;
-t|--theme) -t|--theme)
shift shift
for theme in "${@}"; do for theme in "${@}"; do
@ -203,12 +193,9 @@ while [[ $# -gt 0 ]]; do
exit 1 exit 1
;; ;;
esac esac
# echo "Installing '${theme}' folder version..."
done done
;; ;;
-a|--alternative)
alternative
alternative=true
;;
-h|--help) -h|--help)
usage usage
exit 0 exit 0
@ -219,21 +206,22 @@ while [[ $# -gt 0 ]]; do
exit 1 exit 1
;; ;;
esac esac
shift
done done
if [[ "${#themes[@]}" -eq 0 ]] ; then
themes=("${THEME_VARIANTS[0]}")
fi
if [[ "${#colors[@]}" -eq 0 ]] ; then
colors=("${COLOR_VARIANTS[@]}")
fi
install_theme() { install_theme() {
for theme in "${themes[@]}"; do
for theme in "${themes[@]-${THEME_VARIANTS[0]}}"; do for color in "${colors[@]}"; do
for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${theme}" "${color}" install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${theme}" "${color}"
done done
done done
# restore the names in the source file
if [[ $alternative == true ]]; then
alternative 'unset'
fi
} }
install_theme install_theme