view collector/volume_osx.py @ 8:af6e0049e701

deploy for vite
author drewp@bigasterisk.com
date Mon, 13 Mar 2023 18:54:47 -0700
parents 5ad799e534a5
children
line wrap: on
line source

from osascript import osascript


async def get_volume():
    out = osascript('output volume of (get volume settings)')
    return int(out[1]) / 100


async def set_volume(v: float):
    i = round(v * 100)
    osascript(f"set volume output volume {i}")