nixos/templates/recolor-folders.sh

53 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
# Generated by matugen — recolors Adwaita folder icons with wallpaper palette
# and pulls in Papirus mimetype icons for better file type distinction
ICON_DIR="$HOME/.local/share/icons/WallpaperAdwaita"
ADWAITA="/run/current-system/sw/share/icons/Adwaita"
PAPIRUS="/run/current-system/sw/share/icons/Papirus-Dark"
mkdir -p "$ICON_DIR/scalable/places"
# Create index.theme
cat > "$ICON_DIR/index.theme" << 'THEME'
[Icon Theme]
Name=WallpaperAdwaita
Comment=Adwaita with wallpaper-colored folders and Papirus mimetypes
Inherits=Adwaita,hicolor
DisplayDepth=32
[scalable/places]
Size=128
MinSize=16
MaxSize=512
Type=Scalable
Context=Places
[64x64/mimetypes]
Size=64
MinSize=16
MaxSize=512
Type=Scalable
Context=MimeTypes
THEME
# Recolor all Adwaita place SVGs with wallpaper palette
for svg in "$ADWAITA/scalable/places"/*.svg; do
name=$(basename "$svg")
sed \
-e 's/#438de6/{{colors.primary_container.default.hex}}/gi' \
-e 's/#62a0ea/{{colors.primary_fixed_dim.default.hex}}/gi' \
-e 's/#a4caee/{{colors.primary_fixed.default.hex}}/gi' \
-e 's/#afd4ff/{{colors.primary_fixed.default.hex}}/gi' \
-e 's/#c0d5ea/{{colors.primary_fixed.default.hex}}/gi' \
"$svg" > "$ICON_DIR/scalable/places/$name"
done
# Copy Papirus mimetype icons for better file type distinction
if [ -d "$PAPIRUS/64x64/mimetypes" ]; then
mkdir -p "$ICON_DIR/64x64/mimetypes"
cp -a "$PAPIRUS/64x64/mimetypes"/* "$ICON_DIR/64x64/mimetypes/"
fi
# Update icon cache
gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true