Skip to content

Commit d85b265

Browse files
Merge pull request #353 from lfreixial/hide-battery-on-desktops
2 parents a2ddf12 + 9af78ae commit d85b265

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/CONFIG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ alternatively, if you have no battery and would like a nerdfont icon to indicate
219219
set -g @dracula-no-battery-label ""
220220
```
221221

222+
if you only want to hide the battery widget on a desktop pc, set the following:
223+
224+
```bash
225+
# default is false
226+
set -g @dracula-battery-hide-on-desktop true
227+
```
228+
222229
### compact-alt - [up](#table-of-contents)
223230

224231
This widget allows the user to switch to an alternate list of widgets when the terminal becomes narrow.

scripts/battery.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ main()
172172

173173
bat_perc=$(battery_percent)
174174

175+
hide_on_desktop=$(get_tmux_option "@dracula-battery-hide-on-desktop" false)
176+
# If no battery percent and the feature flag is enabled, hide the widget completely
177+
if $hide_on_desktop && [ -z "$bat_perc" ]; then
178+
echo ""
179+
return
180+
fi
181+
175182
if [ -z "$bat_stat" ]; then # Test if status is empty or not
176183
echo "$bat_label $bat_perc"
177184
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power

0 commit comments

Comments
 (0)