fix: correctly load badge count; expose to renderer (#25)

This commit is contained in:
Paul Makles
2025-12-29 18:47:24 +01:00
committed by GitHub
parent cb373b6dc6
commit 6817b554e5
3 changed files with 18 additions and 18 deletions
+12 -16
View File
@@ -1,23 +1,19 @@
I d#!/usr/bin/env bash
#!/usr/bin/env bash
# Check if we're on NixOS and set up electron path if needed
if [ -f /etc/NIXOS ] || [ -n "$NIX_STORE" ]; then
# We're on NixOS, need to find the electron path
if command -v electron &> /dev/null; then
# Electron is in PATH, find its store path
ELECTRON_BIN=$(which electron)
ELECTRON_STORE_PATH=$(dirname "$ELECTRON_BIN")
export ELECTRON_OVERRIDE_DIST_PATH="$ELECTRON_STORE_PATH"
echo "NixOS detected: Using electron from $ELECTRON_STORE_PATH"
elif [ -d /nix/store ]; then
# Try to find electron in nix store matching our version requirement
REQUIRED_VERSION=$(grep '"electron"' package.json | sed -E 's/.*"([0-9]+)\..*/\1/')
ELECTRON_PATH=$(find /nix/store -maxdepth 1 -name "*electron-${REQUIRED_VERSION}*" -type d 2>/dev/null | grep -v unwrapped | head -1)
if [ -n "$ELECTRON_PATH" ] && [ -d "$ELECTRON_PATH/bin" ]; then
export ELECTRON_OVERRIDE_DIST_PATH="$ELECTRON_PATH/bin"
echo "NixOS detected: Using electron from $ELECTRON_PATH/bin"
fi
# Try to find electron in nix store matching our version requirement
REQUIRED_VERSION=$(grep '"electron"' package.json | sed -E 's/.*"electron"[[:space:]]*:[[:space:]]*"([0-9]+)\..*/\1/')
# Search for electron in nix store
ELECTRON_PATH=$(ls -d /nix/store/*electron-${REQUIRED_VERSION}* 2>/dev/null | grep -v -E '(unwrapped|\.drv$)' | head -1)
if [ -n "$ELECTRON_PATH" ] && [ -d "$ELECTRON_PATH/bin" ]; then
export ELECTRON_OVERRIDE_DIST_PATH="$ELECTRON_PATH/bin"
echo "NixOS detected: Using electron from $ELECTRON_PATH/bin"
else
echo "Warning: Could not find electron ${REQUIRED_VERSION} in nix store"
fi
fi