From 97af93b2a8ebc89364852e3f63e9fd8cfedaeedf Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 9 Jun 2025 13:43:45 +0300 Subject: =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D1=91=D0=BB=20dotfiles?= =?UTF-8?q?=20=D0=BD=D0=B0=20stow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/hypr/hyprlock/status.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 config/hypr/hyprlock/status.sh (limited to 'config/hypr/hyprlock/status.sh') diff --git a/config/hypr/hyprlock/status.sh b/config/hypr/hyprlock/status.sh new file mode 100755 index 0000000..ea2607e --- /dev/null +++ b/config/hypr/hyprlock/status.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############ Variables ############ +enable_battery=false +battery_charging=false + +####### Check availability ######## +for battery in /sys/class/power_supply/*BAT*; do + if [[ -f "$battery/uevent" ]]; then + enable_battery=true + if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then + battery_charging=true + fi + break + fi +done + +############# Output ############# +if [[ $enable_battery == true ]]; then + if [[ $battery_charging == true ]]; then + echo -n " заряжается" + fi + echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"% + if [[ $battery_charging == false ]]; then + echo -n " осталось" + fi +fi + +echo '' -- cgit v1.2.3