This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/_make_theme

83 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
{%@@ if 'papirus' in icon_theme.lower() @@%}
# Papirus Icon Theme
{
papirus-folders -l | grep "[^>] {{@@ accent_color_name @@}}"&&
notify-send "Switching Folder Color"
papirus-folders -uC "{{@@ accent_color_name @@}}" ||
papirus-folders -uD
} &
{%@@ endif @@%}
{%@@ if 'materia' in gtk_theme.lower() @@%}
# Materia GTK Theme
TMPDIR="$HOME/.cache/materia-theme"
theme_name="{{@@ gtk_theme @@}}"
dst_path="$HOME/.themes"
test -d "$TMPDIR" ||
git clone\
"https://github.com/nana-4/materia-theme"\
"$TMPDIR"
cd "$TMPDIR"
# SEL = accent
# BG = header-bar
# HDR = menubar
# View = Main part of file browser
# Surface = background of context menu
colors="\
SEL_BG={{@@ accent_color .lstrip('#') @@}}\n\
FG={{@@ color.txt .lstrip('#') @@}}\n\
BG={{@@ color.bg .lstrip('#') @@}}\n\
HDR_FG={{@@ color.txt .lstrip('#') @@}}\n\
HDR_BG={{@@ color.bg .lstrip('#') @@}}\n\
MATERIA_VIEW={{@@ color.bg .lstrip('#') @@}}\n\
MATERIA_SURFACE={{@@ color.bg .lstrip('#') @@}}"
color_file="${dst_path}/${theme_name}/_colors"
# No changes in input, no change in output
echo -e "$colors" |
diff "$color_file" - &&
exit 0
mkdir -p "${dst_path}/${theme_name}"
{
notify-send "Generating theme in Background"
echo -e "$colors" > "$color_file"
./change_color.sh \
-t "${dst_path}" \
-o "${theme_name}" \
"$color_file"
echo -e "$colors" > "$color_file"
sudo cp -vr "${dst_path}/${theme_name}" /usr/share/themes/ ||
doas cp -vr "${dst_path}/${theme_name}" /usr/share/themes/
notify-send "Finished generating theme"
} &> /dev/null &
{%@@ endif @@%}
{%@@ if 'Orchis' in gtk_theme.lower() @@%}
TMPDIR="$HOME/.cache/share/orchis"
mkdir -p "$TMPDIR" && cd "$TMPDIR"
test -d .git &&
git pull ||
git clone "https://github.com/vinceliuice/Orchis-theme" "$TMPDIR"
./install.sh \
--theme "{{@@ accent_color_name.lower() @@}}" \
--tweaks "solid" --tweaks "compact"
{%@@ endif @@%}