The script takes the output from dualsensectl and displays it as a tray icon via the xfce4-genmon-plugin. It also powers off the controller when you click on the controller icon.
Icons used are free Fontawesome icons. You can replace them with whatever you want.
Note: my setup is for having 2 tray icons for 2 controllers.
You can do something like:
if [ "$battery_level" -ge 75 ]; then
echo "<img>/path/to/icon-full.svg</img>"
echo "<tool>$battery_level%</tool>"
elif [ "$battery_level" -ge 50 ]; then
echo "<img>/path/to/icon-half.svg</img>"
echo "<tool>$battery_level%</tool>"
elif [ "$battery_level" -ge 25 ]; then
echo "<img>/path/to/icon-low.svg</img>"
echo "<tool>$battery_level%</tool>"
elif [ "$battery_level" -ge 0 ]; then
echo "<img>/path/to/icon-empty.svg</img>"
echo "<tool>$battery_level%</tool>"
else
echo "<img>/path/to/icon-inactive.svg</img>"
echo "<tool>Disconnected</tool>"
fi