Add selfh.st icon replacement script for Docker and VM icons

Server-side bash script reads `glass.icon` Docker labels and replaces
Unraid's cached icon PNGs with selfh.st CDN versions. Auto-detects
icon names from container names when no label is set. Supports VMs
via vm-icons.conf mapping file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kaloyan Danchev
2026-02-08 11:29:56 +02:00
parent 969c240553
commit 673366db5f
3 changed files with 313 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ Custom CSS + JS theme for Unraid 7.2.3 WebGUI. B&W mountain wallpaper with frost
|------|---------|--------------------------|---------------------|
| `style.css` | Main CSS theme | `/boot/config/plugins/custom.css/style.css` | `/usr/local/emhttp/plugins/custom.css/style.css` |
| `sidebar.js` | Sidebar toggle + search overlay | `/boot/config/plugins/custom.css/assets/sidebar.js` | `/usr/local/emhttp/plugins/custom.css/assets/sidebar.js` |
| `update-icons.sh` | Replace Docker/VM icons with selfh.st CDN icons | `/boot/config/plugins/custom.css/assets/update-icons.sh` | `/usr/local/emhttp/plugins/custom.css/assets/update-icons.sh` |
| `vm-icons.conf` | VM name → icon name mapping | `/boot/config/plugins/custom.css/assets/vm-icons.conf` | — |
## Deployment
@@ -21,6 +23,9 @@ scp -i ~/.ssh/id_ed25519_unraid -P 422 style.css root@192.168.10.20:/boot/config
scp -i ~/.ssh/id_ed25519_unraid -P 422 style.css root@192.168.10.20:/usr/local/emhttp/plugins/custom.css/style.css
scp -i ~/.ssh/id_ed25519_unraid -P 422 sidebar.js root@192.168.10.20:/boot/config/plugins/custom.css/assets/sidebar.js
scp -i ~/.ssh/id_ed25519_unraid -P 422 sidebar.js root@192.168.10.20:/usr/local/emhttp/plugins/custom.css/assets/sidebar.js
scp -i ~/.ssh/id_ed25519_unraid -P 422 update-icons.sh root@192.168.10.20:/boot/config/plugins/custom.css/assets/update-icons.sh
scp -i ~/.ssh/id_ed25519_unraid -P 422 update-icons.sh root@192.168.10.20:/usr/local/emhttp/plugins/custom.css/assets/update-icons.sh
scp -i ~/.ssh/id_ed25519_unraid -P 422 vm-icons.conf root@192.168.10.20:/boot/config/plugins/custom.css/assets/vm-icons.conf
```
JS injection is handled by `CustomJS_Loader.page` on the server (persisted via `/boot/config/go`).
@@ -106,6 +111,37 @@ The `dynamix.gui.search` plugin uses hover-trigger in sidebar theme. We replace
- Cmd+K / Ctrl+K keyboard shortcut
- Escape to close
## Custom Docker/VM Icons
Icons are sourced from [selfh.st/icons](https://selfh.st/icons/) via jsDelivr CDN.
### How it works
`update-icons.sh` reads a `glass.icon` Docker label from each container, downloads the matching PNG from `https://cdn.jsdelivr.net/gh/selfhst/icons@main/png/{name}.png`, and replaces Unraid's cached icon files. This works on Docker page, VM page, and Dashboard — no client-side JS needed.
### Docker label convention
Add label `glass.icon` to containers:
- Short name: `glass.icon=plex` → fetches from selfh.st CDN
- Full URL: `glass.icon=https://example.com/icon.png` → fetches from URL
- No label: auto-detects from container name (lowercase + CDN HEAD check)
### VM icons
Edit `vm-icons.conf` with `VM_NAME=icon_name` entries (one per line).
### Running
```bash
# Dry run (show what would change)
ssh -i ~/.ssh/id_ed25519_unraid root@192.168.10.20 -p 422 'bash /boot/config/plugins/custom.css/assets/update-icons.sh --dry-run'
# Real run
ssh -i ~/.ssh/id_ed25519_unraid root@192.168.10.20 -p 422 'bash /boot/config/plugins/custom.css/assets/update-icons.sh'
# Force re-download all
ssh -i ~/.ssh/id_ed25519_unraid root@192.168.10.20 -p 422 'bash /boot/config/plugins/custom.css/assets/update-icons.sh --force'
```
### Icon paths on Unraid
- RAM cache: `/usr/local/emhttp/state/plugins/dynamix.docker.manager/images/{Name}-icon.png`
- Persistent: `/var/lib/docker/unraid/images/{Name}-icon.png`
- VM templates: `/usr/local/emhttp/plugins/dynamix.vm.manager/templates/images/`
## Wallpaper
Place wallpaper at `/boot/config/plugins/custom.css/assets/wallpaper.jpg` — accessible at `/custom/wallpaper.jpg`.