#!/bin/sh
# Copyright (c) 2019-2021 Sebastian LaVine <mail@smlavine.com>
# Licensed under the MIT license. See MIT.txt for details.
#
# File: vol
# Description: Gets or sets the system volume.
# Arguments: (optional) argument to amixer (ex. 40%, 500, 5%+, 6%-)
# if there are no arguments, output the percentage volumes of left/right Master
if [ $# -eq 0 ]; then
amixer sget Master | grep -o '\[[0-9]*%\]' | tr -d '[]%' | paste -sd'|'
else
# set the audio according to the first argument
amixer -q set Master "$1"
fi