Added option to print each battery on the same line, check 1.1.md for more info
This commit is contained in:
parent
bb48caec70
commit
6cd2881962
4 changed files with 51 additions and 11 deletions
16
1.1.md
16
1.1.md
|
@ -98,6 +98,22 @@ in your system.
|
||||||
|
|
||||||
- Added `battery_num` which allows you to choose which battery to display, <br \>
|
- Added `battery_num` which allows you to choose which battery to display, <br \>
|
||||||
it also takes the value `all` which will print all batteries line by line.
|
it also takes the value `all` which will print all batteries line by line.
|
||||||
|
- Added `battery_shorthand` which when set to `on` prints each battery on the<br \>
|
||||||
|
same line like so:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# battery_shorthand="on"
|
||||||
|
Battery: 10%, 5%, 67%
|
||||||
|
|
||||||
|
# battery_shorthand="off"
|
||||||
|
Battery0: 10%
|
||||||
|
Battery1: 5%
|
||||||
|
Battery2: 67%
|
||||||
|
|
||||||
|
# If there's only a single battery in the system
|
||||||
|
# we ommit the numbered title.
|
||||||
|
Battery: 10%
|
||||||
|
```
|
||||||
|
|
||||||
- **NOTE:** This currently only works on Linux, support for other platforms is being<br \>
|
- **NOTE:** This currently only works on Linux, support for other platforms is being<br \>
|
||||||
worked on.
|
worked on.
|
||||||
|
|
|
@ -231,6 +231,8 @@ alias fetch2="fetch \
|
||||||
--gtk3 on/off Enable/Disable gtk3 theme/icons output
|
--gtk3 on/off Enable/Disable gtk3 theme/icons output
|
||||||
--shell_path on/off Enable/Disable showing \$SHELL path
|
--shell_path on/off Enable/Disable showing \$SHELL path
|
||||||
--shell_version on/off Enable/Disable showing \$SHELL version
|
--shell_version on/off Enable/Disable showing \$SHELL version
|
||||||
|
--battery_num Which battery to display, default value is 'all'
|
||||||
|
--battery_shorthand Whether or not each battery gets its own line and title
|
||||||
--birthday_shorthand Shorten the output of birthday
|
--birthday_shorthand Shorten the output of birthday
|
||||||
--birthday_time Enable/Disable showing the time in birthday output
|
--birthday_time Enable/Disable showing the time in birthday output
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,11 @@ gtk3="on"
|
||||||
# --battery_num all, 0, 1, 2, etc
|
# --battery_num all, 0, 1, 2, etc
|
||||||
battery_num="all"
|
battery_num="all"
|
||||||
|
|
||||||
|
# Whether or not to print each battery on the same line.
|
||||||
|
# By default each battery gets its own line and title.
|
||||||
|
# --battery_shorthand on/off
|
||||||
|
battery_shorthand="off"
|
||||||
|
|
||||||
|
|
||||||
# Birthday
|
# Birthday
|
||||||
|
|
||||||
|
|
39
fetch
39
fetch
|
@ -142,6 +142,11 @@ gtk3="on"
|
||||||
# --battery_num all, 0, 1, 2, etc
|
# --battery_num all, 0, 1, 2, etc
|
||||||
battery_num="all"
|
battery_num="all"
|
||||||
|
|
||||||
|
# Whether or not to print each battery on the same line.
|
||||||
|
# By default each battery gets its own line and title.
|
||||||
|
# --battery_shorthand on/off
|
||||||
|
battery_shorthand="off"
|
||||||
|
|
||||||
|
|
||||||
# Birthday
|
# Birthday
|
||||||
|
|
||||||
|
@ -1209,18 +1214,26 @@ getbattery () {
|
||||||
# Get the subtitle and reassign it so it doesn't change.
|
# Get the subtitle and reassign it so it doesn't change.
|
||||||
title="$subtitle"
|
title="$subtitle"
|
||||||
|
|
||||||
# If there's only a single battery,
|
# If shorthand is on, print each value on the same line
|
||||||
# don't number the subtitle.
|
if [ "$battery_shorthand" == "on" ]; then
|
||||||
if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then
|
battery=${batteries[@]}
|
||||||
prin "${title}: ${batteries[0]}%"
|
battery=${battery// /%, }
|
||||||
return
|
battery="${battery}%"
|
||||||
fi
|
|
||||||
|
|
||||||
# Print each battery on a seperate line.
|
else
|
||||||
for bat in ${batteries[@]}; do
|
# If there's only a single battery and it's battery 0,
|
||||||
prin "${title}${index}: ${bat}%"
|
# don't number the subtitle.
|
||||||
index=$((index + 1))
|
if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then
|
||||||
done
|
prin "${title}: ${batteries[0]}%"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print each battery on a seperate line.
|
||||||
|
for bat in ${batteries[@]}; do
|
||||||
|
prin "${title}${index}: ${bat}%"
|
||||||
|
index=$((index + 1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
battery="None"
|
battery="None"
|
||||||
fi
|
fi
|
||||||
|
@ -1974,6 +1987,8 @@ usage () { cat << EOF
|
||||||
--gtk3 on/off Enable/Disable gtk3 theme/icons output
|
--gtk3 on/off Enable/Disable gtk3 theme/icons output
|
||||||
--shell_path on/off Enable/Disable showing \$SHELL path
|
--shell_path on/off Enable/Disable showing \$SHELL path
|
||||||
--shell_version on/off Enable/Disable showing \$SHELL version
|
--shell_version on/off Enable/Disable showing \$SHELL version
|
||||||
|
--battery_num Which battery to display, default value is 'all'
|
||||||
|
--battery_shorthand Whether or not each battery gets its own line and title
|
||||||
--birthday_shorthand Shorten the output of birthday
|
--birthday_shorthand Shorten the output of birthday
|
||||||
--birthday_time Enable/Disable showing the time in birthday output
|
--birthday_time Enable/Disable showing the time in birthday output
|
||||||
|
|
||||||
|
@ -2072,6 +2087,8 @@ while [ "$1" ]; do
|
||||||
--gtk3) gtk3="$2" ;;
|
--gtk3) gtk3="$2" ;;
|
||||||
--shell_path) shell_path="$2" ;;
|
--shell_path) shell_path="$2" ;;
|
||||||
--shell_version) shell_version="$2" ;;
|
--shell_version) shell_version="$2" ;;
|
||||||
|
--battery_num) battery_num="$2" ;;
|
||||||
|
--battery_shorthand) battery_shorthand="$2" ;;
|
||||||
--birthday_shorthand) birthday_shorthand="$2" ;;
|
--birthday_shorthand) birthday_shorthand="$2" ;;
|
||||||
--birthday_time) birthday_time="$2" ;;
|
--birthday_time) birthday_time="$2" ;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue