Fixed #72
This commit is contained in:
parent
72c65d0075
commit
7333dc7035
3 changed files with 44 additions and 56 deletions
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
92
install.sh
92
install.sh
|
@ -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}
|
||||||
|
@ -75,11 +58,15 @@ install() {
|
||||||
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
|
||||||
|
|
||||||
|
if [[ ${alternative:-} == 'true' ]]; then
|
||||||
|
cp -r ${SRC_DIR}/alternative/apps/*.svg ${THEME_DIR}/apps/scalable
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${color} == '' && ${theme} != '' ]]; then
|
if [[ ${theme} != '' ]]; then
|
||||||
cp -r ${SRC_DIR}/colors/color${theme}/*.svg ${THEME_DIR}/places/scalable
|
cp -r ${SRC_DIR}/colors/color${theme}/*.svg ${THEME_DIR}/places/scalable
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${color} == '-dark' ]]; then
|
if [[ ${color} == '-dark' ]]; then
|
||||||
mkdir -p ${THEME_DIR}/{apps,categories,emblems,devices,mimes,places,status}
|
mkdir -p ${THEME_DIR}/{apps,categories,emblems,devices,mimes,places,status}
|
||||||
|
@ -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
|
||||||
|
|
||||||
install_theme() {
|
if [[ "${#themes[@]}" -eq 0 ]] ; then
|
||||||
|
themes=("${THEME_VARIANTS[0]}")
|
||||||
|
fi
|
||||||
|
|
||||||
for theme in "${themes[@]-${THEME_VARIANTS[0]}}"; do
|
if [[ "${#colors[@]}" -eq 0 ]] ; then
|
||||||
for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
|
colors=("${COLOR_VARIANTS[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
install_theme() {
|
||||||
|
for theme in "${themes[@]}"; do
|
||||||
|
for color in "${colors[@]}"; 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
|
Loading…
Reference in a new issue