From 7be8163fe6d918a136fb49aaae3c89414e4c9aac Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Tue, 9 Apr 2024 13:59:23 +0300 Subject: [PATCH] hypr: add notification about low bettery --- config/hypr/bat.sh | 13 +++++++++++++ config/hypr/hyprland.conf | 1 + 2 files changed, 14 insertions(+) create mode 100644 config/hypr/bat.sh diff --git a/config/hypr/bat.sh b/config/hypr/bat.sh new file mode 100644 index 0000000..df000b9 --- /dev/null +++ b/config/hypr/bat.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# the purpose of the script is to notify when battery percentage is low + +while true; do + lvl=$(cat /sys/class/power_supply/BAT0/capacity) + if [ "$lbl" -le 30 ]; then + notify-send --urgency=CRITICAL "Battery Low" "Consider plugging cable in" + sleep 1200 + else + sleep 120 + fi +done diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 05e6b45..ac3605c 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -17,6 +17,7 @@ exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CUR exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = swayidle -w timeout 120 '$lock' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep '$lock' exec-once = wlsunset -S 10:00 -s 19:00 +exec-once = ~/.config/hypr/bat.sh # }}} # inputs {{{ input {