scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

commit 4a6c259f4a924d5fc7ad60fa7ee742037e194e47
parent 36ff234d95c5489a4814ef68c5928bf1de598d42
Author: dsp <dsp@2f30.org>
Date:   Wed, 24 Jul 2013 19:02:41 +0100

volume is a simple script to manage mixerctl in openbsd

Diffstat:
Avolume | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/volume b/volume @@ -0,0 +1,22 @@ +#!/bin/sh + +#OpenBSD volume control +#normalizes the input percentage to 0-255 +usageexit() { + echo "$(basename $0) [0-100]" + exit +} + +case $1 in + +([0-9]) ) + if [ $1 -gt 100 -o $1 -lt 0 ]; then + usageexit + fi + typeset -i volvar + volvar=$(printf "%1.0f" $(echo $1 "* 2.55" |bc)) + mixerctl -n outputs.master=$volvar,$volvar + ;; + *) + usageexit + ;; +esac