view collector/volume_osx.py @ 4:5ad799e534a5

move to subdir
author drewp@bigasterisk.com
date Mon, 13 Mar 2023 18:50:23 -0700
parents volume_osx.py@04c8a1b3976b
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}")