From 93bcfe9f9cb176abf95545bd40a80115c7e8ad1f Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 31 May 2023 06:52:57 +0200 Subject: [PATCH] tmuxrc: add battery info --- script/batinfo | 11 +++++++++++ tmux.conf | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 script/batinfo diff --git a/script/batinfo b/script/batinfo new file mode 100755 index 0000000..11d80a4 --- /dev/null +++ b/script/batinfo @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# +# Print battery percentage to stdout + +set -e + +if [ $(uname -s) = "Darwin" ]; then + echo "" # TODO +else # Linux + echo "$(cat /sys/class/power_supply/BAT0/capacity)%" +fi diff --git a/tmux.conf b/tmux.conf index 3979ca8..5650979 100644 --- a/tmux.conf +++ b/tmux.conf @@ -10,7 +10,7 @@ set-option -g set-titles on set-option -g focus-events on set -g status-style 'fg=white, bg=colour8' set -g window-status-current-style 'fg=black, bg=green' -set -g status-right '#[fg=black, bg=colour2] #(sysinfo) #[default] #[fg=white, bg=colour238] %H:%M #[default]' +set -g status-right '#(batinfo) #[fg=black, bg=colour2] #(sysinfo) #[default] #[fg=white, bg=colour238] %H:%M #[default]' set -g status-justify centre set-window-option -g mode-keys vi