diff options
Diffstat (limited to 'inter.py')
| -rw-r--r-- | inter.py | 22 | 
1 files changed, 14 insertions, 8 deletions
| @@ -91,7 +91,7 @@ def mainloop():                  thing = get_selected()                  kind = "sink" if type(thing) == pa.Sink else "input"                  vol = thing.volume() -                if vol[0] != vol[1]: +                if len(vol) >= 2 and vol[0] != vol[1]:                      show_message(                          "Warning: current volume of this " + kind + " is asymmetric!") @@ -140,7 +140,8 @@ def mainloop():                  T.bel()                  continue -            vol = sum(thing.volume()) / 2 +            vol = thing.volume() +            vol = sum(vol) / len(vol)              vol = min(1, max(0, vol + incr))              wrap_pacmd(lambda: thing.set_volume(vol)) @@ -249,13 +250,18 @@ def print_prefix(thing, selected):          T.tprint("  ")  def fmt_volume(vol): -    res = ["", ""] -    for i in range(2): -        res[i] = str(round(100 * vol[i])) + "%" -    if vol[0] == vol[1]: -        return res[0] +    res = [str(round(100 * value)) + "%" for value in vol] +    if len(vol) > 2: +        return res[0] + "/" + res[1] + " (? len(vol)==" + str(len(vol)) + ")" +    elif len(vol) == 2: +        if vol[0] == vol[1]: +            return res[0] +        else: +            return res[0] + "/" + res[1] +    elif len(vol) == 1: +        return res[0] + " (mono)"      else: -        return res[0] + "/" + res[1] +        return "? (len(vol)==0)"  def print_volume(thing):      T.setfg(6) | 
