From 86c638d6659932812d8e438df0bc2763ab390d53 Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 26 Nov 2025 18:11:18 +0300 Subject: [PATCH] add battery status --- home/user/.config/sway/bindings.conf | 5 +++++ home/user/.local/bin/i3blocks_helper | 15 ++++++++++++++- install-hooks/sway/pre-install | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/home/user/.config/sway/bindings.conf b/home/user/.config/sway/bindings.conf index b22549a..5fdebef 100644 --- a/home/user/.config/sway/bindings.conf +++ b/home/user/.config/sway/bindings.conf @@ -181,3 +181,8 @@ input type:keyboard { repeat_delay 250 repeat_rate 100 } + +input type:touchpad { + tap enabled + dwt enabled +} diff --git a/home/user/.local/bin/i3blocks_helper b/home/user/.local/bin/i3blocks_helper index db51542..b4fc3d8 100755 --- a/home/user/.local/bin/i3blocks_helper +++ b/home/user/.local/bin/i3blocks_helper @@ -17,7 +17,20 @@ cmd_ethernet() { } cmd_battery() { - return 0 # todo + charging_status="$(cat /sys/class/power_supply/BAT0/status)" + percent="$(cat /sys/class/power_supply/BAT0/capacity)" + + if [ "${percent}" -lt 35 ]; then + emoji_status="đŸĒĢ" + else + emoji_status="🔋" + fi + + if [ "${charging_status}" = "Charging" ]; then + emoji_status="🔌" + fi + + printf "%s %s%%\n" "${emoji_status}" "${percent}" } cmd_disk_root() { diff --git a/install-hooks/sway/pre-install b/install-hooks/sway/pre-install index 45cd9f2..529e62c 100755 --- a/install-hooks/sway/pre-install +++ b/install-hooks/sway/pre-install @@ -1,3 +1,3 @@ #!/bin/sh -echo "pacman -S sway swaybg waybar swaylock swayidle wl-clipboard ydotool grim slurp mako wlr-randr" +echo "pacman -S sway swaybg i3blocks waybar swaylock swayidle wl-clipboard ydotool grim slurp mako wlr-randr rofi jq"