#!/bin/bash

USAGE=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | head -n1)
TEMP=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | head -n1)

if [[ -z "$USAGE" || -z "$TEMP" ]]; then
  echo '{"icon": "", "usage": "?", "temp": "?"}'
else
  echo "{\"icon\": \"\", \"usage\": \"$USAGE\", \"temp\": \"$TEMP\"}"
fi

