
import subprocess
import sys
import re
import os
import math


volume_scale = 0.70


def set_volume(value):
    if os.name == "posix":
        return
    result = subprocess.run(["amixer", "-M", "set", "Master", "{}%".format(math.floor(value * volume_scale))], stdout=subprocess.PIPE)


def get_volume():
    if os.name == "posix":
        return 0
    result = subprocess.run(["amixer", "-M", "get", "Master"], stdout=subprocess.PIPE)
    matches = re.findall("[0-9]{1,3}%", str(result.stdout))
    vol =  math.floor(int(matches[0].replace("%","")) / volume_scale)
    return vol

@@ -57,16 +57,22 @@
  math%0A%0A%0A
+linux_
 volume_s
@@ -83,18 +83,43 @@
  = 0.70%0A
+mac_volumme_scale = 1.0%0A
 %0A%0A
+%0A
 def set_
@@ -172,15 +172,118 @@
     
-return%0A
+subprocess.check_output(%22osascript -e 'set volume output volume %7B%7D'%22.format(value), shell=True)%0A    else:%0A    
     
@@ -452,32 +452,33 @@
 ame == %22posix%22:%0A
+%0A
         return 0
@@ -475,15 +475,171 @@
   re
-turn 0%0A
+sult = subprocess.check_output(%22osascript -e 'output volume of (get volume settings)'%22, shell=True)%0A        print(result)%0A        return int(result)%0A    else:%0A    
     
@@ -721,16 +721,20 @@
 s.PIPE)%0A
+    
     matc
@@ -785,16 +785,20 @@
 tdout))%0A
+    
     vol 
@@ -859,16 +859,20 @@
 _scale)%0A
+    
     retu

add working volume control for mac