nixos/templates/recolor-folders.sh

90 lines
2 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 with all mimetype sizes
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
[16x16/mimetypes]
Size=16
Type=Fixed
Context=MimeTypes
[22x22/mimetypes]
Size=22
Type=Fixed
Context=MimeTypes
[32x32/mimetypes]
Size=32
Type=Fixed
Context=MimeTypes
[48x48/mimetypes]
Size=48
Type=Fixed
Context=MimeTypes
[64x64/mimetypes]
Size=64
MinSize=32
MaxSize=128
Type=Scalable
Context=MimeTypes
[96x96/mimetypes]
Size=96
MinSize=64
MaxSize=256
Type=Scalable
Context=MimeTypes
[128x128/mimetypes]
Size=128
MinSize=64
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 at all available sizes
for size in 16x16 22x22 32x32 48x48 64x64 96x96 128x128; do
if [ -d "$PAPIRUS/$size/mimetypes" ]; then
rm -rf "$ICON_DIR/$size/mimetypes"
mkdir -p "$ICON_DIR/$size/mimetypes"
cp -rL "$PAPIRUS/$size/mimetypes"/* "$ICON_DIR/$size/mimetypes/"
fi
done
# Update icon cache
gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true