Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
2a081d6e
Commit
2a081d6e
authored
Mar 30, 2020
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
battery: remove printf usage where possible
Spares us of the need to quote % symbols
parent
3da469be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
battery.plugin.zsh
plugins/battery/battery.plugin.zsh
+3
-3
No files found.
plugins/battery/battery.plugin.zsh
View file @
2a081d6e
...
@@ -175,7 +175,7 @@ function battery_level_gauge() {
...
@@ -175,7 +175,7 @@ function battery_level_gauge() {
local
filled_symbol
=
${
BATTERY_GAUGE_FILLED_SYMBOL
:-
'▶'
}
local
filled_symbol
=
${
BATTERY_GAUGE_FILLED_SYMBOL
:-
'▶'
}
local
empty_symbol
=
${
BATTERY_GAUGE_EMPTY_SYMBOL
:-
'▷'
}
local
empty_symbol
=
${
BATTERY_GAUGE_EMPTY_SYMBOL
:-
'▷'
}
local
charging_color
=
${
BATTERY_CHARGING_COLOR
:-
$color_yellow
}
local
charging_color
=
${
BATTERY_CHARGING_COLOR
:-
$color_yellow
}
local
charging_symbol
=
${
BATTERY_CHARGING_SYMBOL
:-
'%
%{%%G⚡%
%}'
}
local
charging_symbol
=
${
BATTERY_CHARGING_SYMBOL
:-
'%
{%G⚡
%}'
}
local
battery_remaining_percentage
=
$(
battery_pct
)
local
battery_remaining_percentage
=
$(
battery_pct
)
local
filled empty gauge_color
local
filled empty gauge_color
...
@@ -201,11 +201,11 @@ function battery_level_gauge() {
...
@@ -201,11 +201,11 @@ function battery_level_gauge() {
battery_is_charging
&&
charging
=
$charging_symbol
battery_is_charging
&&
charging
=
$charging_symbol
# Charging status and prefix
# Charging status and prefix
print
f
${
charging_color
//\%/\%\%
}
$charging
${
color_reset
//\%/\%\%
}${
battery_prefix
//\%/\%\%
}${
gauge_color
//\%/\%\%
}
print
-n
${
charging_color
}${
charging
}${
color_reset
}${
battery_prefix
}${
gauge_color
}
# Filled slots
# Filled slots
[[
$filled
-gt
0
]]
&&
printf
${
filled_symbol
//\%/\%\%
}
'%.0s'
{
1..
$filled
}
[[
$filled
-gt
0
]]
&&
printf
${
filled_symbol
//\%/\%\%
}
'%.0s'
{
1..
$filled
}
# Empty slots
# Empty slots
[[
$filled
-lt
$gauge_slots
]]
&&
printf
${
empty_symbol
//\%/\%\%
}
'%.0s'
{
1..
$empty
}
[[
$filled
-lt
$gauge_slots
]]
&&
printf
${
empty_symbol
//\%/\%\%
}
'%.0s'
{
1..
$empty
}
# Suffix
# Suffix
print
f
${
color_reset
//\%/\%\%
}${
battery_suffix
//\%/\%\%
}${
color_reset
//\%/\%\%
}
print
-n
${
color_reset
}${
battery_suffix
}${
color_reset
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment