#!/usr/bin/env bash

raw_percent=$(pamixer --get-volume-human)
if [ "$raw_percent" == "muted" ]; then
    echo "{\"icon\": \"\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"muted\\\")\"}"
else
    percent=$(echo "$raw_percent" | sed 's/[^0-9]*//g')
    #if [ "$percent" -gt 66 ]; then
    #    icon=""
    #elif [ "$percent" -gt 33 ]; then
    #    icon=""
    #elif [ "$percent" -gt 0 ]; then
    #    icon=""
    #else
    #    icon=""
    #fi
    icon=""
    volume="$percent%"
    echo "{\"icon\": \"${icon}\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"${volume}\\\")\"}"
fi
