From 273db9af59275f0e2a9d5e6305d11c2d80d01eee Mon Sep 17 00:00:00 2001 From: MikeG Date: Sun, 6 Oct 2024 13:13:35 -0400 Subject: [PATCH] added brightness notification script --- .config/dunst/dunstrc | 6 ++++++ .config/sway/config | 4 ++-- Scripts/brightness_notif.sh | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100755 Scripts/brightness_notif.sh diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 5b2ae60..060062e 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -356,6 +356,12 @@ # Icon for notifications with critical urgency, uncomment to enable #default_icon = /path/to/icon +[Volume] + history_ignore = true + +[Brightness] + history_ignore = true + # Every section that isn't one of the above is interpreted as a rules to # override settings for certain messages. # diff --git a/.config/sway/config b/.config/sway/config index f484860..d1ad267 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -245,8 +245,8 @@ bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && /h bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && /home/emge/Scripts/volume-notif.sh bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && /home/emge/Scripts/volume-notif.sh bindsym XF86AudioMicMute exec pactl set-source-mute @DEFUALT_SOURCE@ toggle -bindsym XF86MonBrightnessDown exec brightnessctl set 5%- -bindsym XF86MonBrightnessUp exec brightnessctl set 5%+ +bindsym XF86MonBrightnessDown exec brightnessctl set 5%- && /home/emge/Scripts/brightness_notif.sh +bindsym XF86MonBrightnessUp exec brightnessctl set 5%+ && /home/emge/Scripts/brightness_notif.sh # # Status Bar: diff --git a/Scripts/brightness_notif.sh b/Scripts/brightness_notif.sh new file mode 100755 index 0000000..60a3f00 --- /dev/null +++ b/Scripts/brightness_notif.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# dunst change brightness notification + +# set varialbe $brightness to current brightness level +brightness=$(cat /sys/class/backlight/acpi_video0/actual_brightness) + +# set variable $max to current max brightness level +max=$(cat /sys/class/backlight/acpi_video0/max_brightness) + +# calculate percentage +brightness_percent=$(((brightness * 100) / max)) + +# show brightness notification +dunstify -u low -i brightness -h string:x-dunst-stack-tag:Brightness -h int:value:"$brightness_percent" "Brightness: ${brightness_percent}%"