From 56c51002e3d57a3f766a16a6e28583d7ac8316d5 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Sat, 10 Oct 2020 21:33:28 +0200 Subject: [PATCH] Script for handling backlight --- arch-config/scripts/dunst-backlight.sh | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 arch-config/scripts/dunst-backlight.sh diff --git a/arch-config/scripts/dunst-backlight.sh b/arch-config/scripts/dunst-backlight.sh new file mode 100644 index 00000000..ce75b117 --- /dev/null +++ b/arch-config/scripts/dunst-backlight.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# You can call this script like this: +# $./dunst-backlight.sh up +# $./dunst-backlight.sh down + +get_light() { + xbacklight -get +} + +send_notification() { + light=$(get_light) + # Make the bar with the special character ─ (it's not dash -) + # https://en.wikipedia.org/wiki/Box-drawing_character + bar=$(seq -s "─" $(($light/ 5)) | sed 's/[0-9]//g') + # Send the notification + dunstify -i whitebalance -r 2489 " $bar" +} + +case $1 in + up) + # Increase backlight + xbacklight -inc 10 + send_notification + ;; + down) + # Decrease backlight + xbacklight -dec 10 + send_notification + ;; +esac