From 9ba43fdeb560dfb65ae031cab923decf819731ae Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 19 Oct 2016 21:40:02 +0200 Subject: [PATCH] Add bin/arch scripts --- bin/arch/panel_notify.sh | 8 ++++++++ bin/arch/volume.sh | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 bin/arch/panel_notify.sh create mode 100755 bin/arch/volume.sh diff --git a/bin/arch/panel_notify.sh b/bin/arch/panel_notify.sh new file mode 100755 index 00000000..f1abb999 --- /dev/null +++ b/bin/arch/panel_notify.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +pgrep panel.sh >/dev/null || exit + +FIFO=/tmp/panel-fifo + +[[ -f $FIFO ]] || exit +echo "$@" > "/tmp/panel-fifo" diff --git a/bin/arch/volume.sh b/bin/arch/volume.sh new file mode 100755 index 00000000..70c0bbc9 --- /dev/null +++ b/bin/arch/volume.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +if [[ $# == 0 ]] +then + echo "Usage: volume.sh [+|-|unmute|mute]" + exit 1 +fi + +COMMAND=$1 +case "$COMMAND" in + [+-]) amixer set Master 10%$COMMAND ;; + *mute) amixer set Master $COMMAND ;; + *) + echo "Invalid command" + exit 1 + ;; +esac + +# Report to lemonbar, if active +if amixer get Master | grep '\[off\]' >/dev/null +then + panel_notify.sh "V0" +else + panel_notify.sh "V$(amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)" +fi