~smlavine/scripts

ref: 5af0022d2df522079823605c7340e26ab9847202 scripts/src/vol -rwxr-xr-x 530 bytes
5af0022dSebastian LaVine dotfiles -> scripts 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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