#!/bin/bash

EWW_VARIABLE_NAME="media-close-time"
EWW_DISPLAY_TIME=10

case "$1" in
"play-pause" | "stop" | "next" | "previous")
  playerctl "$1"
  ;;
"display")
  EWW_DISPLAY_TIME=${2:-10}
  ;;
*)
  echo "Invalid Entry"
  exit 1
  ;;
esac

eww update "$EWW_VARIABLE_NAME=$(($(date +%s) + $EWW_DISPLAY_TIME))"
