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 directory injected by the Nix derivation via environment variable
|
||||||
ICON_DIR = os.environ.get("SOVRAN_HUB_ICONS", "")
|
ICON_DIR = os.environ.get("SOVRAN_HUB_ICONS", "")
|
||||||
|
|
||||||
|
# Supported icon extensions in priority order
|
||||||
|
ICON_EXTENSIONS = [".svg", ".png"]
|
||||||
|
|
||||||
|
|
||||||
class ServiceTile(Gtk.Box):
|
class ServiceTile(Gtk.Box):
|
||||||
"""A square tile showing a service logo, name, status, toggle, and restart."""
|
"""A square tile showing a service logo, name, status, toggle, and restart."""
|
||||||
@@ -106,16 +109,26 @@ class ServiceTile(Gtk.Box):
|
|||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def _set_logo(self, icon_name: str):
|
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:
|
if icon_name and ICON_DIR:
|
||||||
png_path = os.path.join(ICON_DIR, f"{icon_name}.png")
|
for ext in ICON_EXTENSIONS:
|
||||||
if os.path.isfile(png_path):
|
icon_path = os.path.join(ICON_DIR, f"{icon_name}{ext}")
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
if os.path.isfile(icon_path):
|
||||||
png_path, 48, 48, True
|
if ext == ".svg":
|
||||||
)
|
# GTK4 handles SVGs natively via GdkPixbuf
|
||||||
texture = Gdk.Texture.new_for_pixbuf(pixbuf)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||||
self._logo.set_from_paintable(texture)
|
icon_path, 48, 48, True
|
||||||
return
|
)
|
||||||
|
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
|
# Fallback: themed symbolic icon
|
||||||
self._logo.set_from_icon_name("system-run-symbolic")
|
self._logo.set_from_icon_name("system-run-symbolic")
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ let
|
|||||||
pkgs.libadwaita
|
pkgs.libadwaita
|
||||||
pkgs.gobject-introspection
|
pkgs.gobject-introspection
|
||||||
pkgs.gdk-pixbuf
|
pkgs.gdk-pixbuf
|
||||||
|
pkgs.librsvg
|
||||||
];
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
@@ -85,7 +86,7 @@ let
|
|||||||
cp style.css $out/lib/sovran-hub/style.css
|
cp style.css $out/lib/sovran-hub/style.css
|
||||||
|
|
||||||
# Copy logos from the repo (no fetchurl needed)
|
# 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
|
# Install the generated config
|
||||||
cp ${generatedConfig} $out/lib/sovran-hub/config.json
|
cp ${generatedConfig} $out/lib/sovran-hub/config.json
|
||||||
|
|||||||