diff --git a/1.1.md b/1.1.md
index 5233ba6e..4aa7e40c 100644
--- a/1.1.md
+++ b/1.1.md
@@ -98,6 +98,22 @@ in your system.
- Added `battery_num` which allows you to choose which battery to display,
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
+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
worked on.
diff --git a/README.md b/README.md
index 63f942c7..5f39d2bd 100644
--- a/README.md
+++ b/README.md
@@ -231,6 +231,8 @@ alias fetch2="fetch \
--gtk3 on/off Enable/Disable gtk3 theme/icons output
--shell_path on/off Enable/Disable showing \$SHELL path
--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_time Enable/Disable showing the time in birthday output
diff --git a/config/config b/config/config
index 4067b2b0..92591c20 100644
--- a/config/config
+++ b/config/config
@@ -122,6 +122,11 @@ gtk3="on"
# --battery_num all, 0, 1, 2, etc
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
diff --git a/fetch b/fetch
index e7ee0323..39ef59e8 100755
--- a/fetch
+++ b/fetch
@@ -142,6 +142,11 @@ gtk3="on"
# --battery_num all, 0, 1, 2, etc
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
@@ -1209,18 +1214,26 @@ getbattery () {
# Get the subtitle and reassign it so it doesn't change.
title="$subtitle"
- # If there's only a single battery,
- # don't number the subtitle.
- if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then
- prin "${title}: ${batteries[0]}%"
- return
- fi
+ # If shorthand is on, print each value on the same line
+ if [ "$battery_shorthand" == "on" ]; then
+ battery=${batteries[@]}
+ battery=${battery// /%, }
+ battery="${battery}%"
- # Print each battery on a seperate line.
- for bat in ${batteries[@]}; do
- prin "${title}${index}: ${bat}%"
- index=$((index + 1))
- done
+ else
+ # If there's only a single battery and it's battery 0,
+ # don't number the subtitle.
+ if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then
+ 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
battery="None"
fi
@@ -1974,6 +1987,8 @@ usage () { cat << EOF
--gtk3 on/off Enable/Disable gtk3 theme/icons output
--shell_path on/off Enable/Disable showing \$SHELL path
--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_time Enable/Disable showing the time in birthday output
@@ -2072,6 +2087,8 @@ while [ "$1" ]; do
--gtk3) gtk3="$2" ;;
--shell_path) shell_path="$2" ;;
--shell_version) shell_version="$2" ;;
+ --battery_num) battery_num="$2" ;;
+ --battery_shorthand) battery_shorthand="$2" ;;
--birthday_shorthand) birthday_shorthand="$2" ;;
--birthday_time) birthday_time="$2" ;;