#!/bin/sh
# Adjust this path to wherever dank-material-shell drops its color file
THEME_CACHE="$HOME/.cache/DankMaterialShell/dms-colors.json"

if [ -f "$THEME_CACHE" ]; then
  # Parse hex tokens directly out of the active shell profile
  BG=$(jq -r '.["colors"]["dark"]["background"]' "$THEME_CACHE" | tr -d '#')
  FG=$(jq -r '.["colors"]["dark"]["surface_container_lowest"]' "$THEME_CACHE" | tr -d '#')
  TXT=$(jq -r '.["colors"]["dark"]["on_background"]' "$THEME_CACHE" | tr -d '#')
  PRIMARY=$(jq -r '.["colors"]["dark"]["surface_container_lowest"]' "$THEME_CACHE" | tr -d '#')
  ON_PRIMARY=$(jq -r '.["colors"]["dark"]["on_background"]' "$THEME_CACHE" | tr -d '#')

  echo -e "BG: $BG\nFG: $FG\nText: $TXT\nFG-Special: $PRIMARY\nText-Special: $ON_PRIMARY\n"
  
  wvkbd-mobintl --hidden --bg "$BG" --press "$BG" --fg "$FG" --text "$TXT" --fg-sp "$PRIMARY" --text-sp "$ON_PRIMARY" -L 300
else
  # Default fallback if the shell cache isn't built yet
  wvkbd-mobintl --hidden
fi
