From a4f4944b5eb2e9b2b5128315e96034b6938c9bf9 Mon Sep 17 00:00:00 2001 From: elena Date: Fri, 12 Jan 2018 07:34:10 +0200 Subject: [PATCH] added signal based volume scripts Former-commit-id: 1e0f121e546ea94484c4239412fdeb89dcd9f659 Former-commit-id: 82b4a6efae5e9285c105d10c690545491728e918 Former-commit-id: 1a9fa022ffa1a57d51f23642ca5a83b74ea2a473 --- Scripts/volume.sh | 37 +++++++++++++++++++++++++++++++++++-- Scripts/volume_sig.sh | 13 +++++++++++++ Scripts/volume_wakeup.sh | 4 ++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100755 Scripts/volume_sig.sh create mode 100755 Scripts/volume_wakeup.sh diff --git a/Scripts/volume.sh b/Scripts/volume.sh index 43c5e63..ecc0178 100755 --- a/Scripts/volume.sh +++ b/Scripts/volume.sh @@ -14,10 +14,43 @@ if [[ "$MUTE" != "no" ]]; then # echo "  " # Text only - echo "vol off" + echo "VOL OFF" + + # Line + # echo "-----------" else # Text only - echo "vol $VOL" + if [ "${VOL%?}" -ge "10" ]; then + echo "VOL $VOL" + else + echo "VOL $VOL" + fi + + # Line (with siji icons) + # VOL="$(echo ${VOL%?})" + # if [ "$VOL" -ge "100" ]; then + # echo " ----------| " + # elif [ "$VOL" -ge "90" ]; then + # echo " ---------|- " + # elif [ "$VOL" -ge "80" ]; then + # echo " --------|-- " + # elif [ "$VOL" -ge "70" ]; then + # echo " -------|--- " + # elif [ "$VOL" -ge "60" ]; then + # echo " ------|---- " + # elif [ "$VOL" -ge "50" ]; then + # echo " -----|----- " + # elif [ "$VOL" -ge "40" ]; then + # echo " ----|------ " + # elif [ "$VOL" -ge "30" ]; then + # echo " ---|------- " + # elif [ "$VOL" -ge "20" ]; then + # echo " --|-------- " + # elif [ "$VOL" -ge "10" ]; then + # echo " -|--------- " + # else + # echo " |---------- " + # fi # Icon only (simple) # echo "  " diff --git a/Scripts/volume_sig.sh b/Scripts/volume_sig.sh new file mode 100755 index 0000000..b63090c --- /dev/null +++ b/Scripts/volume_sig.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Write PID to that file so other processes can send signals to me +echo $$ > /tmp/volume_pid + +while : # This is the same as "while true". +do + # I do this when I wake up + ~/Scripts/volume.sh + # Then I go back to sleep + sleep 1d + #echo "woke up!" +done diff --git a/Scripts/volume_wakeup.sh b/Scripts/volume_wakeup.sh new file mode 100755 index 0000000..4e1f213 --- /dev/null +++ b/Scripts/volume_wakeup.sh @@ -0,0 +1,4 @@ +#!/bin/bash +VOLUME_PID="$(cat /tmp/volume_pid)" + +pkill -P $VOLUME_PID sleep