From c2fbc4d1717864a0055592e0b73d71c010e8686c Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Fri, 8 Nov 2024 20:48:58 +0000 Subject: Initial commit --- .config/eww/scripts/brightnesscontrol | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 .config/eww/scripts/brightnesscontrol (limited to '.config/eww/scripts/brightnesscontrol') diff --git a/.config/eww/scripts/brightnesscontrol b/.config/eww/scripts/brightnesscontrol new file mode 100755 index 0000000..1e8ea9f --- /dev/null +++ b/.config/eww/scripts/brightnesscontrol @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# You can call this script like this: +# brightnessControl up +# brightnessControl down + +# Script inspired by these wonderful people: +# https://github.com/dastorm/volume-notification-dunst/blob/master/volume.sh +# https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a + +function send_notification { + icon="/usr/share/icons/Adwaita/symbolic/status/daytime-sunrise-symbolic.svg" + brightness=$(backlight -q) + # Make the bar with the special character ─ (it's not dash -) + # https://en.wikipedia.org/wiki/Box-drawing_character + bar=$(seq -s "─" 0 $((brightness / 10 )) | sed 's/[0-9]//g') + # Send the notification + fyi -i "$icon" --hint=string:x-canonical-private-synchronous:brightness -u normal "$bar $brightness" +} + +case $1 in + up) + backlight + 4 + backlight > ~/.cache/brightness + send_notification + # canberra-gtk-play -i audio-volume-change + ;; + down) + backlight - 4 + backlight > ~/.cache/brightness + send_notification + # canberra-gtk-play -i audio-volume-change + ;; + *) + brightness=$(backlight -q) + icon="" + printf "%s" "$icon $brightness" "%" + ;; +esac -- cgit v1.2.3