From f6f970e5780d3678ba076805a5cc250d4d25c949 Mon Sep 17 00:00:00 2001 From: "tibo.depeuter" Date: Sat, 9 Apr 2022 21:49:34 +0200 Subject: [PATCH] Notifications --- .config/i3/scripts/notify.sh | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .config/i3/scripts/notify.sh diff --git a/.config/i3/scripts/notify.sh b/.config/i3/scripts/notify.sh new file mode 100644 index 0000000..18b53ff --- /dev/null +++ b/.config/i3/scripts/notify.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Show system status in notification, or your own message +# Syntaxis: notify [-vb] + +# Variables +duration=3 +value=0 + +# Get options +while getopts ":bvm:" options; do + case "${options}" in + b) + value=$(brightnessctl | grep -o "[0-9]*%") + title="Brightness: ${value}" + ;; + v) + 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} + ;; + *) + title="Unknown option" + ;; + esac +done + +shift $((OPTIND - 1)) + +notify-send "${title:-${message}}" "${message}" \ + -h int:value:"$(grep -o "[0-9]*" <<< ${value})" \ + -h string:x-canonical-private-synchronous:byMe # Replace if not yet gone + + #-h geometry = "400x200-40-40" \ +canberra-gtk-play -i audio-volume-change -d "changeVolume"