all repos — dotfiles @ c10456ceb1899ffa049ed17d1be861884392cdbc

my *nix dotfiles

bin/vol.sh (view raw)

 1#!/usr/bin/env bash
 2
 3fg="$(xres color0)"
 4light="$(xres color8)"
 5
 6while getopts idq options
 7do
 8	case $options in
 9		i)
10			amixer sset Master 2%+
11			;;
12
13		d)
14			amixer sset Master 2%-
15			;;
16		q)
17			if [[ $(amixer get Master | awk -F"[][] " '{ print $3 }' | tr -d '\n') = "[on]" ]]
18			then
19				cur_vol=$(amixer get Master | awk -F"[][]" '/dB/ { print $2 }' | tr -d '\n')
20				echo -ne "%{F$light}vol %{F$fg}$cur_vol"
21			else
22				echo -ne "%{F$light}vol %{F$fg}muted"
23			fi
24			;;
25	esac
26done