[theme-changer] Add eww

This commit is contained in:
Viyurz 2024-10-21 11:26:05 +02:00
parent e8adde376c
commit aef6d8f485
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8

View file

@ -98,9 +98,10 @@ function set_theme {
source "$HOME/.cache/wal/colors.sh" source "$HOME/.cache/wal/colors.sh"
set_theme_variables set_theme_variables
set_eww_scss_file
set_gtk_css_file set_gtk_css_file
for component in desktop_wallpaper hyprland kitty mako pywalfox waybar wlogout wofi; do for component in desktop_wallpaper eww hyprland kitty mako pywalfox waybar wlogout wofi; do
set_${component}_theme & set_${component}_theme &
done done
} }
@ -135,6 +136,16 @@ function set_theme_variables {
} }
function set_eww_scss_file {
echo -n '' > "$HOME/.config/eww/colors.scss"
for key in "${!colors[@]}"; do
value="${colors[$key]}"
echo -e "\$$key: $value;" >> "$HOME/.config/eww/colors.scss"
done
}
function set_gtk_css_file { function set_gtk_css_file {
mkdir -p "$HOME/.config/gtk-3.0" &> /dev/null mkdir -p "$HOME/.config/gtk-3.0" &> /dev/null
echo -n '' > "$HOME/.config/gtk-3.0/colors.css" echo -n '' > "$HOME/.config/gtk-3.0/colors.css"
@ -148,7 +159,7 @@ function set_gtk_css_file {
function set_betterdiscord_theme { function set_betterdiscord_theme {
if which betterdiscordctl > /dev/null; then if which betterdiscordctl > /dev/null; then
echo "Executable found for betterdiscordctl." echo "Executable found for betterdiscordctl."sy
if [[ ! -f "$HOME/.config/BetterDiscord/data/stable/custom.css" ]]; then if [[ ! -f "$HOME/.config/BetterDiscord/data/stable/custom.css" ]]; then
echo "Downloading ClearVision theme for BetterDiscord." echo "Downloading ClearVision theme for BetterDiscord."
mkdir -p "$HOME/.config/BetterDiscord/data/stable" mkdir -p "$HOME/.config/BetterDiscord/data/stable"
@ -196,6 +207,19 @@ function set_desktop_wallpaper_theme {
} }
function set_eww_theme {
declare -A eww_variables=(
[font-family]="${params[font]}"
[border-bottom]="${params[border_size]}px solid transparent"
)
for key in "${!eww_variables[@]}"; do
value="${eww_variables[$key]}"
sed -i "s~$key:[^;]*~$key: $value~" "$HOME/.config/eww/eww.scss"
done
}
function set_hyprland_theme { function set_hyprland_theme {
echo -n '' > "$HOME/.config/hypr/hyprland.d/colors.conf" echo -n '' > "$HOME/.config/hypr/hyprland.d/colors.conf"