mirror of
https://github.com/tmux-plugins/tmux-battery.git
synced 2026-09-10 07:26:19 -04:00
feat: add battery_enabled script (#118)
This commit is contained in:
parent
65b0c5261b
commit
e3b7fe0641
11
README.md
11
README.md
|
|
@ -144,6 +144,17 @@ Status Icons:
|
|||
- attached (`@batt_icon_status_attached`): '⚠️'
|
||||
- unknown (`@batt_icon_status_unknown`): '?'
|
||||
|
||||
#### Enabled
|
||||
|
||||
If you run `battery_enabled.tmux` from the top-level of the repo, it will setup a `@battery_enabled` variable, that can be used to selectively display the battery based on whether or not a battery is available or not.
|
||||
|
||||
```tmux
|
||||
run-shell ~/clone/path/battery_enabled.tmux
|
||||
# for example, if using catppuccin:
|
||||
set -agF status-right "#{?#{#{==:#{E:@battery_exists},true}},#{E:@catppuccin_status_battery},}"
|
||||
run-shell ~/clone/path/battery.tmux
|
||||
```
|
||||
|
||||
#### Changing the Defaults
|
||||
|
||||
All efforts have been made to make sane defaults, but if you wish to change any of them, add the option to `.tmux.conf`. For example:
|
||||
|
|
|
|||
10
battery_enabled.tmux
Executable file
10
battery_enabled.tmux
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/scripts/helpers.sh"
|
||||
|
||||
main() {
|
||||
tmux set-option -gq "@battery_exists" "$( [ -n "$(battery_status)" ] && echo true || echo false )"
|
||||
}
|
||||
main
|
||||
Loading…
Reference in a new issue