make tmux show the battery in the status line

This commit is contained in:
sebastian committed 2026-09-17 14:52:39 +02:00
1 parent 07c5ee399f
commit 148dc3c783
2 files changed
+28

No files matched your search

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Insert the battery segment in tmux-power's status-right, right before the time segment.
batt=' #{battery_color_fg}#{battery_icon_status} #{battery_percentage} '
icon=$(tmux show -gv @tmux_power_time_icon)
cur=$(tmux show -gv status-right)
new=$(BATT="$batt" ICON="$icon" perl -0pe 's/((?:#\[[^\]]*\])+[^#]*\Q$ENV{ICON}\E)/$ENV{BATT}$1/' <<< "$cur")
tmux set -g status-right "$new"