updated icons
|
Before Width: | Height: | Size: 4.7 KiB |
1
app/icons/bitcoind.svg
Normal file
|
Before Width: | Height: | Size: 4.9 KiB |
1
app/icons/btcpayserver.svg
Normal file
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
1
app/icons/electrs.svg
Normal file
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
1
app/icons/lnd.svg
Normal file
|
Before Width: | Height: | Size: 1.5 KiB |
1
app/icons/mempool.svg
Normal file
|
Before Width: | Height: | Size: 12 KiB |
1
app/icons/nextcloud.svg
Normal file
|
Before Width: | Height: | Size: 1.5 KiB |
1
app/icons/rtl.svg
Normal file
|
Before Width: | Height: | Size: 2.1 KiB |
1
app/icons/synapse.svg
Normal file
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
1
app/icons/vaultwarden.svg
Normal file
|
Before Width: | Height: | Size: 18 KiB |
1
app/icons/wordpress.svg
Normal file
@@ -19,6 +19,9 @@ LOADING_STATES = {"reloading", "activating", "deactivating", "maintenance"}
|
||||
# Icon directory injected by the Nix derivation via environment variable
|
||||
ICON_DIR = os.environ.get("SOVRAN_HUB_ICONS", "")
|
||||
|
||||
# Supported icon extensions in priority order
|
||||
ICON_EXTENSIONS = [".svg", ".png"]
|
||||
|
||||
|
||||
class ServiceTile(Gtk.Box):
|
||||
"""A square tile showing a service logo, name, status, toggle, and restart."""
|
||||
@@ -106,16 +109,26 @@ class ServiceTile(Gtk.Box):
|
||||
self.refresh()
|
||||
|
||||
def _set_logo(self, icon_name: str):
|
||||
"""Set the tile logo from a PNG in the icons dir, or fall back to a symbolic icon."""
|
||||
"""Set the tile logo from an SVG or PNG in the icons dir."""
|
||||
if icon_name and ICON_DIR:
|
||||
png_path = os.path.join(ICON_DIR, f"{icon_name}.png")
|
||||
if os.path.isfile(png_path):
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
png_path, 48, 48, True
|
||||
)
|
||||
texture = Gdk.Texture.new_for_pixbuf(pixbuf)
|
||||
self._logo.set_from_paintable(texture)
|
||||
return
|
||||
for ext in ICON_EXTENSIONS:
|
||||
icon_path = os.path.join(ICON_DIR, f"{icon_name}{ext}")
|
||||
if os.path.isfile(icon_path):
|
||||
if ext == ".svg":
|
||||
# GTK4 handles SVGs natively via GdkPixbuf
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
icon_path, 48, 48, True
|
||||
)
|
||||
texture = Gdk.Texture.new_for_pixbuf(pixbuf)
|
||||
self._logo.set_from_paintable(texture)
|
||||
else:
|
||||
# PNG path
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
icon_path, 48, 48, True
|
||||
)
|
||||
texture = Gdk.Texture.new_for_pixbuf(pixbuf)
|
||||
self._logo.set_from_paintable(texture)
|
||||
return
|
||||
|
||||
# Fallback: themed symbolic icon
|
||||
self._logo.set_from_icon_name("system-run-symbolic")
|
||||
|
||||
@@ -67,6 +67,7 @@ let
|
||||
pkgs.libadwaita
|
||||
pkgs.gobject-introspection
|
||||
pkgs.gdk-pixbuf
|
||||
pkgs.librsvg
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
@@ -85,7 +86,7 @@ let
|
||||
cp style.css $out/lib/sovran-hub/style.css
|
||||
|
||||
# Copy logos from the repo (no fetchurl needed)
|
||||
cp icons/*.png $out/share/sovran-hub/icons/
|
||||
cp icons/* $out/share/sovran-hub/icons/ 2>/dev/null || true
|
||||
|
||||
# Install the generated config
|
||||
cp ${generatedConfig} $out/lib/sovran-hub/config.json
|
||||
|
||||