dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5d9e54c6f770f55c49491bc5a45bda262d7c3bbf
parent 879b1140462a972c2036fb4f2dd9c0272123f9d1
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue, 17 Sep 2019 15:11:19 -0400

xrandr-brightness & pactl-volume


Former-commit-id: ebefcd9362fe0a185f90d3767a2d5a271016678e
Diffstat:
Ascripts/pactl-volume | 19+++++++++++++++++++
Mscripts/xrandr-brightness | 4++--
2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/scripts/pactl-volume b/scripts/pactl-volume @@ -0,0 +1,19 @@ +#!/bin/sh +#/usr/bin/pactl set-sink-volume 0 +5% +SINK=$( pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1 ) +NOW=$( pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' ) +if [ "$1" = "up" ]; then + /usr/bin/pactl set-sink-mute "$SINK" 0 + if [ $((NOW+5)) -le 100 ]; then + /usr/bin/pactl set-sink-volume "$SINK" "+5%" + else + /usr/bin/pactl set-sink-volume "$SINK" "100%" + fi +elif [ "$1" = "down" ]; then + if [ $((NOW-5)) -gt 0 ]; then + /usr/bin/pactl set-sink-volume "$SINK" "-5%" + else + /usr/bin/pactl set-sink-volume "$SINK" "0%" + /usr/bin/pactl set-sink-mute "$SINK" 1 + fi +fi diff --git a/scripts/xrandr-brightness b/scripts/xrandr-brightness @@ -2,12 +2,12 @@ if [ "$1" = "up" ]; then brightness="$(xrandr --verbose |grep Brightness |grep -o '[0-9].*')" if ! [ "$brightness" = "1.0" ]; then - xrandr --output LVDS-0 --brightness $(echo "$brightness+0.05" | bc) + xrandr --output LVDS-0 --brightness $(echo "$brightness 0.05" | awk '{printf "%f", $1 + $2}') fi elif [ "$1" = "down" ]; then brightness="$(xrandr --verbose |grep Brightness |grep -o '[0-9].*')" if ! [ "$brightness" = "0.0" ]; then - xrandr --output LVDS-0 --brightness $(echo "$brightness-0.05" | bc) + xrandr --output LVDS-0 --brightness $(echo "$brightness 0.05" | awk '{printf "%f", $1 - $2}') fi elif [ "$1" = "gamma" ]; then xrandr --output LVDS-0 --gamma "$2"