view volume_osx.py @ 3:3d7fc94a404a

a few more inputs; daemonize
author drewp@bigasterisk.com
date Wed, 08 Mar 2023 10:57:11 -0800
parents 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}")