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

69 lines
1.8 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
src_path="$HOME/.cache/materia-theme"
theme_name="{{@@ gtk_theme @@}}"
dst_path="${HOME}/.themes"
test -d "$src_path" ||
git clone\
"https://github.com/nana-4/materia-theme"\
"$src_path"
cd "$src_path"
# 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 @@%}