From 4bab00a291ec2f13e91fe00efd8dd48dbc8e3c6f Mon Sep 17 00:00:00 2001 From: Mosder Date: Sun, 2 Nov 2025 00:55:37 +0100 Subject: 🔧 chore(dunst): add dunst configuration file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 📝 config: add detailed dunst configuration with defaults and documentation --- laptop/.config/hypr/hyprland.conf | 7 ++--- laptop/.config/hypr/scripts/battery-notifier.sh | 36 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100755 laptop/.config/hypr/scripts/battery-notifier.sh (limited to 'laptop/.config/hypr') diff --git a/laptop/.config/hypr/hyprland.conf b/laptop/.config/hypr/hyprland.conf index 9cf630c..05fea03 100644 --- a/laptop/.config/hypr/hyprland.conf +++ b/laptop/.config/hypr/hyprland.conf @@ -39,6 +39,7 @@ exec-once = flameshot exec-once = $scriptsDir/randomize-wallpaper.sh exec-once = hyprpaper exec-once = hypridle +exec-once = $scriptsDir/battery-notifier.sh # Lock after autologin in sddm, to use lockscreen as login exec-once = hyprlock @@ -239,11 +240,11 @@ bind = $mainMod, F, exec, $fileManager bind = ALT, SPACE, exec, pkill $menu || $menu bind = $mainMod, B, exec, $browser bind = $mainMod, D, exec, discord -binds = Control_L, D&I&E, exec, shutdown -h 0 bind = $mainMod, I, exec, intellij-idea-ultimate-edition bind = $mainMod SHIFT, S, exec, flameshot gui bind = $mainMod SHIFT, P, exec, hyprpicker -a bind = $mainMod, L, exec, hyprlock +bind = $mainMod, N, exec, dunstctl close-all # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l @@ -288,8 +289,8 @@ bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+ -bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%- +bindel = ,XF86MonBrightnessUp, exec, brightnessctl set 5%+ +bindel = ,XF86MonBrightnessDown, exec, brightnessctl set 5%- # Requires playerctl bindl = , XF86AudioNext, exec, playerctl next diff --git a/laptop/.config/hypr/scripts/battery-notifier.sh b/laptop/.config/hypr/scripts/battery-notifier.sh new file mode 100755 index 0000000..d586879 --- /dev/null +++ b/laptop/.config/hypr/scripts/battery-notifier.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +while true; do + # get battery status + acpi_info=$(acpi) + stat=$(echo $acpi_info | awk -F" " '{print $3}') + stat=${stat::-1} + perc=$(echo $acpi_info | awk -F" " '{print $4}') + perc=${perc::-2} + + # check if battery is discharging + if [[ $stat == Discharging ]]; then + # send notification if low power + if [[ $perc -le 15 ]]; then + notify-send -a Battery BATTERY\ CRITICAL\ -h int:value:$perc -u critical + elif [[ $perc -le 30 ]]; then + notify-send -a Battery Battery\ low\ -h int:value:$perc + fi + fi + + # calculate time until next check using interpolating polynomial + # of points (battery %, time [s] until next check): + # (100, 600) + # (50, 120) + # (30, 60) + # (15, 30) + # (0, 0) + x1=$(echo "scale=10; 188/85*$perc" | bc) + x2=$(echo "scale=10; -603/29750*$perc*$perc" | bc) + x3=$(echo "scale=10; 113/297500*$perc*$perc*$perc" | bc) + x4=$(echo "scale=10; 3/1487500*$perc*$perc*$perc*$perc" | bc) + sleep_time=$(echo $x1+$x2+$x3+$x4 | bc | awk -F"." '{print $1}') + + # sleep for calculated time + sleep $sleep_time +done -- cgit v1.2.3