refactor: move state migration to pre-flight, fix XDG hardcoding, and prevent Nix store bloat
This commit is contained in:
@@ -13,7 +13,7 @@ let
|
||||
fi
|
||||
'';
|
||||
nomarchy-font-selector = pkgs.writeShellScriptBin "nomarchy-font-selector" ''
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
STATE_DIR="${config.home.homeDirectory}/.config/home-manager"
|
||||
STATE_FILE="$STATE_DIR/state.json"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
@@ -30,18 +30,23 @@ let
|
||||
fi
|
||||
'';
|
||||
nomarchy-wallpaper-selector = pkgs.writeShellScriptBin "nomarchy-wallpaper-selector" ''
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
STATE_DIR="${config.home.homeDirectory}/.config/home-manager"
|
||||
STATE_FILE="$STATE_DIR/state.json"
|
||||
THEMES_DIR="$HOME/.local/share/nomarchy/themes"
|
||||
THEMES_DIR="${config.xdg.dataHome}/nomarchy/themes"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
||||
|
||||
# List all images in all themes backgrounds
|
||||
WALLPAPERS=$(find "$THEMES_DIR" -type f \( -name "*.jpg" -o -name "*.png" \))
|
||||
# We search in the system-wide flake source for distro wallpapers to avoid Nix Store bloat
|
||||
WALLPAPERS=$(find "${config.xdg.dataHome}/nomarchy/themes" -type f \( -name "*.jpg" -o -name "*.png" \) 2>/dev/null)
|
||||
DISTRO_THEMES="/etc/nixos/nomarchy/assets/themes"
|
||||
if [ -d "$DISTRO_THEMES" ]; then
|
||||
WALLPAPERS="$WALLPAPERS\n$(find "$DISTRO_THEMES" -type f \( -name "*.jpg" -o -name "*.png" \))"
|
||||
fi
|
||||
# Include user themes if they exist
|
||||
if [ -d "$HOME/.config/nomarchy/themes" ]; then
|
||||
WALLPAPERS="$WALLPAPERS\n$(find "$HOME/.config/nomarchy/themes" -type f \( -name "*.jpg" -o -name "*.png" \))"
|
||||
if [ -d "${config.home.homeDirectory}/.config/nomarchy/themes" ]; then
|
||||
WALLPAPERS="$WALLPAPERS\n$(find "${config.home.homeDirectory}/.config/nomarchy/themes" -type f \( -name "*.jpg" -o -name "*.png" \))"
|
||||
fi
|
||||
SELECTED_WP=$(echo -e "$WALLPAPERS" | walker --dmenu)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user