import subprocess from theme import current_theme, default data = subprocess.run( ["wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@"], stdout=subprocess.PIPE, encoding="utf-8", ).stdout.strip() _, decimal, *muted = data.split(" ") decimal = float(decimal) muted = muted[0] if muted else "" icon = "󰝟" if muted == "[MUTED]" else "󰕾" color = ( f"^c{current_theme.base7}^" if muted == "[MUTED]" else f"^c{current_theme.base8}^" ) vol_string = f"{decimal:.0%}" content = f"^v^{color}{icon} {vol_string:>4}^t^"