2025-02-04, 03:18 AM
Theme creator: https://github.com/tedhinklater/finimalism
![[Image: 68747470733a2f2f692e696d6775722e636f6d2f...2e6a706567]](https://camo.githubusercontent.com/2761cbd23dfc9841d0ed37577d63b4d2cc3a3988f18792e2320ab555492cf6ac/68747470733a2f2f692e696d6775722e636f6d2f54765456386a712e6a706567)
Add this to custom CSS code in dashboard settings
This Linux bash script automates the installation and management of the Finimalism7 theme for offline use. It provides you with four options: full installation, font updates, theme CSS file updates, and file verification. The script handles downloading theme assets, managing file permissions, replacing Google Font references with local files, and ensuring correct ownership for the Jellyfin service.
.sh file attachment as not allowed and for good reason
Code:
#!/bin/bash
# Set variables
THEME_DIR="/usr/share/jellyfin/web/themes/finimalism7"
FONT_URL="https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000&display=swap"
FONT_DIR="$THEME_DIR/fonts"
LOCAL_FONT_CSS="$THEME_DIR/fonts.css"
MAIN_CSS="$THEME_DIR/finimalism7.css"
GITHUB_RAW="https://raw.githubusercontent.com/tedhinklater/finimalism/main"
# Function to download and process fonts
download_fonts() {
sudo mkdir -p "$FONT_DIR"
sudo curl -s "$FONT_URL" | sudo tee "$LOCAL_FONT_CSS" > /dev/null
# Download ALL font files from the CSS
sudo grep -oP "https://fonts\.gstatic\.com/s/sofiasans/v16/[^\s)]*\.ttf" "$LOCAL_FONT_CSS" | while read -r font_url; do
font_file=$(basename "$font_url")
sudo curl -s "$font_url" -o "$FONT_DIR/$font_file"
echo "Downloaded: $font_file"
done
# Replace ALL Google font URLs with local paths
sudo sed -i 's|https://fonts\.gstatic\.com/s/sofiasans/v16/|/web/themes/finimalism7/fonts/|g' "$LOCAL_FONT_CSS"
}
# Function to update theme CSS files
update_theme_css() {
sudo wget -O "$MAIN_CSS" "$GITHUB_RAW/finimalism7.css"
sudo wget -O "$THEME_DIR/libraryCardAriaText.css" "$GITHUB_RAW/libraryCardAriaText.css"
sudo wget -O "$THEME_DIR/theme.css" "$GITHUB_RAW/theme.css"
# Ensure the directory exists and has correct permissions
sudo mkdir -p "$THEME_DIR/libary-cards"
sudo chown $USER:$USER "$THEME_DIR/libary-cards"
sudo chmod 755 "$THEME_DIR/libary-cards"
# Download libary-cards folder contents (images)
for image in Audiobooks.png Books.png Boxsets.png Games.png HomeVideos.png Movies.png Music.png MusicVideos.png Photos.png Playlists.png TVShows.png; do
if sudo wget -O "$THEME_DIR/libary-cards/$image" "$GITHUB_RAW/libary-cards/$image"; then
echo "Downloaded: $image"
sudo chown $USER:$USER "$THEME_DIR/libary-cards/$image"
sudo chmod 644 "$THEME_DIR/libary-cards/$image"
else
echo "Failed to download: $image"
fi
done
# Replace Google Fonts link with local fonts.css
sudo sed -i 's|https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000&display=swap|/web/themes/finimalism7/fonts.css?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000|g' "$MAIN_CSS"
# Update the first line to use local fonts.css
sudo sed -i '1s|@import url("https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000&display=swap");|@import url("/web/themes/finimalism7/fonts.css?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000");|' "$MAIN_CSS"
# Replace remaining https://fonts.gstatic.com URLs
sudo sed -i 's|https://fonts.gstatic.com/s/sofiasans/v16/|/web/themes/finimalism7/fonts/|g' "$MAIN_CSS"
echo -e "\n/* Imports */\n@import url('/web/themes/finimalism7/fonts.css?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000');\n@import url('/web/themes/finimalism7/libraryCardAriaText.css');\n@import url('/web/themes/finimalism7/theme.css');" | sudo tee -a "$MAIN_CSS" > /dev/null
}
# Function to check and update files
check_and_update_files() {
echo "Checking and updating files..."
# Update fonts.css
if [ -f "$LOCAL_FONT_CSS" ]; then
sudo sed -i 's|https://fonts.gstatic.com/s/sofiasans/v16/|/web/themes/finimalism7/fonts/|g' "$LOCAL_FONT_CSS"
echo "Updated fonts.css"
fi
# Update main CSS file
if [ -f "$MAIN_CSS" ]; then
sudo sed -i 's|https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000&display=swap|/web/themes/finimalism7/fonts.css?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000|g' "$MAIN_CSS"
sudo sed -i '1s|@import url("https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000&display=swap");|@import url("/web/themes/finimalism7/fonts.css?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000");|' "$MAIN_CSS"
sudo sed -i 's|https://fonts.gstatic.com/s/sofiasans/v16/|/web/themes/finimalism7/fonts/|g' "$MAIN_CSS"
echo "Updated main CSS file"
fi
# Self-check
echo "Performing self-check..."
local issues_found=false
# Check fonts.css
if [ -f "$LOCAL_FONT_CSS" ]; then
if grep -q "https://fonts.gstatic.com/s/sofiasans/v16/" "$LOCAL_FONT_CSS"; then
echo "WARNING: fonts.css still contains references to Google Fonts."
issues_found=true
fi
else
echo "WARNING: fonts.css file not found."
issues_found=true
fi
# Check main CSS file
if [ -f "$MAIN_CSS" ]; then
if grep -q "https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,1..1000;1,1..1000&display=swap" "$MAIN_CSS"; then
echo "WARNING: Main CSS file still contains references to Google Fonts CSS."
issues_found=true
fi
if grep -q "https://fonts.gstatic.com/s/sofiasans/v16/" "$MAIN_CSS"; then
echo "WARNING: Main CSS file still contains references to Google Fonts."
issues_found=true
fi
else
echo "WARNING: Main CSS file not found."
issues_found=true
fi
if [ "$issues_found" = false ]; then
echo "Self-check completed. All files appear to be correctly updated."
else
echo "Self-check completed. Some issues were found. Please review the warnings above."
fi
}
# Main menu
echo "Finimalism7 Theme Installer/Updater"
echo "1. Full Install"
echo "2. Update Fonts Only"
echo "3. Update Theme CSS Files Only"
echo "4. Check and Update Files"
echo "Please enter your choice (1-4):"
read choice
case $choice in
1)
echo "You're about to perform a full install. This will download all theme files and fonts."
read -p "Do you want to continue? (y/n): " confirm
if [[ $confirm == [Yy]* ]]; then
echo "Performing full install..."
sudo mkdir -p "$THEME_DIR"
download_fonts
update_theme_css
check_and_update_files
else
echo "Operation cancelled."
fi
;;
2)
echo "You're about to update fonts only. This will download all font files."
read -p "Do you want to continue? (y/n): " confirm
if [[ $confirm == [Yy]* ]]; then
echo "Updating fonts only..."
download_fonts
check_and_update_files
else
echo "Operation cancelled."
fi
;;
3)
echo "You're about to update theme CSS files only. This will download all theme files."
read -p "Do you want to continue? (y/n): " confirm
if [[ $confirm == [Yy]* ]]; then
echo "Updating theme CSS files only..."
update_theme_css
check_and_update_files
else
echo "Operation cancelled."
fi
;;
4)
echo "You're about to check and update all files."
read -p "Do you want to continue? (y/n): " confirm
if [[ $confirm == [Yy]* ]]; then
check_and_update_files
else
echo "Operation cancelled."
fi
;;
*)
echo "Invalid choice. Exiting."
exit 1
;;
esac
# Set permissions
sudo chown -R jellyfin:jellyfin "$THEME_DIR"
sudo chmod -R 755 "$THEME_DIR"
echo "Operation completed."
echo "Please add the following line to Jellyfin's Custom CSS:"
echo "@import url(\"/web/themes/finimalism7/finimalism7.css\");"
Add this to custom CSS code in dashboard settings
Code:
@import url("/web/themes/finimalism7/finimalism7.css");
@import url("/web/themes/finimalism7/libraryCardAriaText.css");
This Linux bash script automates the installation and management of the Finimalism7 theme for offline use. It provides you with four options: full installation, font updates, theme CSS file updates, and file verification. The script handles downloading theme assets, managing file permissions, replacing Google Font references with local files, and ensuring correct ownership for the Jellyfin service.
.sh file attachment as not allowed and for good reason
