make tmux show the battery in the status line
This commit is contained in:
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"
|
||||
@@ -27,6 +27,23 @@ set-window-option -g pane-base-index 1
|
||||
|
||||
#set -g @tmux_power_theme 'forest'
|
||||
|
||||
#
|
||||
#Battery in the status bar (next to the time)
|
||||
|
||||
#set -g status-right '#{battery_icon_status} #{battery_percentage} | %H:%M '
|
||||
set -g status-interval 30
|
||||
|
||||
# Optional: color by charge level
|
||||
set -g @batt_icon_status_charged ''
|
||||
set -g @batt_icon_status_charging ''
|
||||
set -g @batt_icon_status_discharging ''
|
||||
set -g @batt_icon_status_attached ''
|
||||
# (status-right is set by tmux-power; the battery gets appended below after TPM)
|
||||
|
||||
# Plugins
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-battery'
|
||||
|
||||
#
|
||||
# Tmux Power
|
||||
#
|
||||
@@ -107,6 +124,10 @@ set -ga update-environment TERM_PROGRAM
|
||||
|
||||
run '~/.config/tmux/plugins/tpm/tpm'
|
||||
|
||||
# Battery: insert before tmux-power's time segment, then let tmux-battery fill in the placeholders
|
||||
run '~/.config/tmux/tmux-battery-insert.sh'
|
||||
run '~/.config/tmux/plugins/tmux-battery/battery.tmux'
|
||||
|
||||
# Pane-Titel anzeigen
|
||||
set -g pane-border-status top
|
||||
set -g pane-border-format ' #{pane_index}: #{pane_title} '
|
||||
|
||||
Reference in new issue
Block a user