Added notis

This commit is contained in:
Tibo De Peuter 2022-03-21 16:00:53 +01:00
parent e86dc82e6e
commit 8590bb0c29
2 changed files with 22 additions and 29 deletions

View file

@ -4,31 +4,21 @@
# Variables
duration=3
bright=''
vol=''
title=''
message=''
# Functions
function getVol () {
status=$(amixer get Master | grep "^ Front Left" | cut -d ' ' -f 8)
if [[ $status == "[on]" ]] ; then
vol=$(amixer get Master | grep -o "[0-9]*%" | head -n 1)
else
vol="0%"
fi
} ; export -f getVol
value=0
# Get options
while getopts ":bvm:" options; do
case "${options}" in
b)
bright=$(brightnessctl | grep -o "[0-9]*%")
title="Brightness: ${bright}"
value=$(brightnessctl | grep -o "[0-9]*%")
title="Brightness: ${value}"
;;
v)
getVol
title="Volume: ${vol:-'0%'}"
status=$(amixer get Master | grep "^ Front Left" | cut -d ' ' -f 8)
if [[ $status == "[on]" ]] ; then
value=$(amixer get Master | grep -o "[0-9]*%" | head -n 1)
fi
title="Volume: ${value:-'0%'}"
;;
m)
message=${OPTARG}
@ -42,8 +32,8 @@ done
shift $((OPTIND - 1))
notify-send "${title:-${message}}" "${message}" \
-h int:x:100 -h int:y:100 \
-h int:value:"$(grep -o "[0-9]*" <<< ${value})" \
-h string:x-canonical-private-synchronous:byMe # Replace if not yet gone
# sleep ${duration}; killall notify-osd
#-h geometry = "400x200-40-40" \
canberra-gtk-play -i audio-volume-change -d "changeVolume"