mirror of
https://github.com/Felitendo/spotifast.git
synced 2026-11-01 17:33:26 +01:00
22 lines
949 B
Bash
Executable File
22 lines
949 B
Bash
Executable File
#!/bin/bash
|
|
# Install with: omarchy hook install theme-set contrib/omarchy/spotifast-theme
|
|
set -euo pipefail
|
|
|
|
# These overrides also let the hook be tested without changing the desktop.
|
|
theme_dir=${SPOTIFAST_OMARCHY_THEME_DIR:-$HOME/.local/state/omarchy/current/theme}
|
|
themes_dir=${SPOTIFAST_THEMES_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/spotifast/themes}
|
|
source_file=$theme_dir/spotifast.json
|
|
|
|
# A theme without a generated palette leaves the last accepted colors alone.
|
|
[[ -f $source_file && ! -L $source_file ]] || exit 0
|
|
mkdir -p -- "$themes_dir"
|
|
temporary=$(mktemp "$themes_dir/.omarchy.XXXXXX")
|
|
trap 'rm -f -- "$temporary"' EXIT
|
|
cp -- "$source_file" "$temporary"
|
|
chmod 644 "$temporary"
|
|
mv -f -- "$temporary" "$themes_dir/omarchy.json"
|
|
|
|
# This command only contacts an existing instance. A stopped app stays stopped.
|
|
# The next launch reads the file if no instance is running or predates reload.
|
|
spotifast reload-themes >/dev/null 2>&1 || true
|