Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions battery_enabled.tmux
Original file line number Diff line number Diff line change
@@ -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