Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Style fixes in build_theme.sh

parent b24a77ae
......@@ -4,6 +4,7 @@
# If <install-target> is unset or empty, the theme is installed into ~/.local/share/themes/<theme name>
set -e
# Usage: create_folders <target-directory>
create_folders () {
for j in gtk-2.0 gtk-3.18 gtk-3.20; do
if ! [ -d "$1/$j" ]; then
......@@ -12,6 +13,7 @@ create_folders () {
done
}
# Usage: build_sass <source-directory> <target-directory> <include-directory>
build_sass() {
if command -v sassc >/dev/null 2>&1; then
sassc -I "$3" "$1" "$2"
......@@ -20,30 +22,34 @@ build_sass() {
fi
}
# Usage: install_theme <theme-directory> <theme-name> <install-target-dir>
# If <insall-target-dir> is unset empty, install to $HOME/.local/share/themes/$THEME_NAME
install_theme () {
COLOR_SCHEME="$1"
INSTALL_TARGET="$2"
if [ -z "$INSTALL_TARGET" ]; then
INSTALL_TARGET="$HOME/.local/share/themes/$COLOR_SCHEME"
THEME_INSTALL_TARGET="$3"
if [ -z "${THEME_INSTALL_TARGET}" ]; then
THEME_INSTALL_TARGET="${HOME}/.local/share/themes/$2"
fi
mkdir -p "$INSTALL_TARGET"
mkdir -p "${THEME_INSTALL_TARGET}"
for dir in assets gtk-2.0 gtk-3.18 gtk-3.20; do
if [ -d "$INSTALL_TARGET/$dir" ]; then
rm -rf "${INSTALL_TARGET:?}/$dir"
if [ -d "${THEME_INSTALL_TARGET}/$dir" ]; then
rm -rf "${THEME_INSTALL_TARGET:?}/$dir"
fi
mv -f "$COLOR_SCHEME/$dir" "$INSTALL_TARGET"
mv -f "$1/$dir" "${THEME_INSTALL_TARGET}"
done
rmdir "$COLOR_SCHEME"
rmdir "$1"
}
# Usage render_theme <colorscheme> <theme-name> <theme-install-target>
render_theme () {
create_folders "$2"
cp -R gtk2/* "$2/gtk-2.0/"
python3 render_assets.py -c "$1" -a "$2/assets" -g "$2/gtk-2.0" -G "$2"
build_sass gtk318/gtk.scss "$2/gtk-3.18/gtk.css" "$2"
build_sass gtk320/gtk.scss "$2/gtk-3.20/gtk.css" "$2"
rm -f "$2/_global.scss"
install_theme "$2" "$3"
THEME_BUILD_DIR="$(mktemp -d)"
create_folders "${THEME_BUILD_DIR}"
cp -R gtk2/* "${THEME_BUILD_DIR}/gtk-2.0/"
python3 render_assets.py -c "$1" -a "${THEME_BUILD_DIR}/assets" \
-g "${THEME_BUILD_DIR}/gtk-2.0" -G "${THEME_BUILD_DIR}"
build_sass gtk318/gtk.scss "${THEME_BUILD_DIR}/gtk-3.18/gtk.css" "${THEME_BUILD_DIR}"
build_sass gtk320/gtk.scss "${THEME_BUILD_DIR}/gtk-3.20/gtk.css" "${THEME_BUILD_DIR}"
rm -f "${THEME_BUILD_DIR}/_global.scss"
install_theme "${THEME_BUILD_DIR}" "$2" "$3"
}
# TODO : add --help and improve parameter parsing
......@@ -67,4 +73,3 @@ else
echo "colorscheme $COLOR_SCHEME not found"
fi
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment