view volume_osx.py @ 2:0ecb388a0b90

start power code
author drewp@bigasterisk.com
date Sat, 04 Mar 2023 12:10:36 -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}")