#!/usr/bin/env bash
# Dependencies: bash>=3.2, coreutils, file
# Makes the script more portable
readonly DIR="$HOME/stuf/customization/"
# Optional icon to display before the text
# Insert the absolute path of the icon
# Recommended size is 24x24 px
declare -r ICON_ARRAY=(
"${DIR}/icons/dice/inverted-dice-1.png"
"${DIR}/icons/dice/inverted-dice-2.png"
"${DIR}/icons/dice/inverted-dice-3.png"
"${DIR}/icons/dice/inverted-dice-4.png"
"${DIR}/icons/dice/inverted-dice-5.png"
"${DIR}/icons/dice/inverted-dice-6.png"
)
# Compute random die
DIE=$(( RANDOM % 6 ))
# Panel
if [[ $(file -b "${ICON_ARRAY[DIE]}") =~ PNG|SVG ]]; then
INFO="
${ICON_ARRAY[DIE]}xfce4-panel --plugin-event=genmon-14:refresh:bool:true"
fi
# Tooltip
MORE_INFO=""
MORE_INFO+="$(( DIE + 1 ))"
MORE_INFO+=""
# Panel Print
echo -e "${INFO}"
# Tooltip Print
echo -e "${MORE_INFO}"