Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
4f83162e
Commit
4f83162e
authored
Mar 13, 2016
by
Dylan
Browse files
Options
Browse Files
Download
Plain Diff
Add progress bars support.
parents
27fa6924
80e91fda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
191 additions
and
14 deletions
+191
-14
README.md
README.md
+16
-0
config
config/config
+35
-0
neofetch
neofetch
+140
-14
No files found.
README.md
View file @
4f83162e
...
@@ -324,6 +324,22 @@ alias fetch2="fetch \
...
@@ -324,6 +324,22 @@ alias fetch2="fetch \
--block_range start end Range of colors to print as blocks
--block_range start end Range of colors to print as blocks
Progress Bars:
--progress_char char Character to use when drawing progress bars.
--progress_length num Length in spaces to make the progress bars.
--progress_colors num num Colors to make the progress bar. Set in this order:
elapsed, total
--cpu_display mode1 mode2 Which shorthand to use and how CPU usage should be printed
mode1 takes: name, speed, tiny, on, off
mode2 takes: info, bar, infobar, barinfo
--memory_display mode Which way should the memory progress bar be added
Takes bar, infobar, barinfo
--battery_display mode Which way should the battery progress bar be added
Takes bar, infobar, barinfo
--disk_display mode Which way should the disk progress bar be added
Takes bar, infobar, barinfo
Image:
Image:
--image type Image source. Where and what image we display.
--image type Image source. Where and what image we display.
Possible values: wall, shuffle, ascii,
Possible values: wall, shuffle, ascii,
...
...
config/config
View file @
4f83162e
...
@@ -227,6 +227,41 @@ prompt_height=1
...
@@ -227,6 +227,41 @@ prompt_height=1
# }}}
# }}}
# Progress Bars {{{
# Progress bar character
# --progress_char char
progress_char
=
"━"
# Progress bar length in spaces
# Number of chars long to make the progress bars.
# --progress_length num
progress_length
=
"15"
# Progress bar colors
# --progress_colors col col
progress_color_elapsed
=
"6"
progress_color_total
=
"8"
# Customize how the info is displayed.
# bar: Only the progress bar is displayed.
# infobar: The bar is displayed after the info.
# barinfo: The bar is displayed before the info.
# off: Only the info is displayed.
#
# --cpu_displau bar/infobar/barinfo/off
# --memory_display bar/infobar/barinfo/off
# --battery_display bar/infobar/barinfo/off
# --disk_display bar/infobar/barinfo/off
cpu_display
=
"off"
memory_display
=
"off"
battery_display
=
"off"
disk_display
=
"off"
# }}}
# Image Options {{{
# Image Options {{{
...
...
neofetch
View file @
4f83162e
...
@@ -115,10 +115,11 @@ shell_version="off"
...
@@ -115,10 +115,11 @@ shell_version="off"
# scaling_current, scaling_min, scaling_max
# scaling_current, scaling_min, scaling_max
speed_type
=
"max"
speed_type
=
"max"
# CPU
shorthand
# CPU
Display
#
Decice to show name only, speed only, or short info
#
Set shorthand setting and progress bar setting
# --cpu_
shorthand name, speed, tiny, on, off
# --cpu_
display (name, speed, tiny, on, off) (bar, infobar, barinfo, off)
cpu_shorthand
=
"off"
cpu_shorthand
=
"off"
cpu_display
=
"off"
# GPU
# GPU
...
@@ -249,6 +250,39 @@ prompt_height=1
...
@@ -249,6 +250,39 @@ prompt_height=1
# }}}
# }}}
# Progress Bars {{{
# Progress bar character
# --progress_char char
progress_char
=
"━"
# Progress bar length in spaces
# Number of chars long to make the progress bars.
# --progress_length num
progress_length
=
"15"
# Progress bar colors
# --progress_colors col col
progress_color_elapsed
=
"6"
progress_color_total
=
"8"
# Customize how the info is displayed.
# bar: Only the progress bar is displayed.
# infobar: The bar is displayed after the info.
# barinfo: The bar is displayed before the info.
# off: Only the info is displayed.
#
# --memory_display bar/infobar/barinfo/off
# --battery_display bar/infobar/barinfo/off
# --disk_display bar/infobar/barinfo/off
memory_display
=
"off"
battery_display
=
"off"
disk_display
=
"off"
# }}}
# Image Options {{{
# Image Options {{{
...
@@ -880,10 +914,24 @@ getcpu () {
...
@@ -880,10 +914,24 @@ getcpu () {
cpu=
${
cpu
/AMD
}
cpu=
${
cpu
/AMD
}
case "
$cpu_shorthand
" in
case "
$cpu_shorthand
" in
"
tiny
") cpu
${
cpu
/@*
}
;;
"
tiny
") cpu
=
${
cpu
/@*
}
;;
esac
esac
;;
;;
esac
esac
# Add CPU info bar
prin "
${
subtitle
}
:
${
cpu
}
"
cpu_usage="
$(
ps aux |
awk
'BEGIN { sum = 0 } { sum += $3 }; END { print sum }'
)
"
cpu_usage="
${
cpu_usage
/\.*
}
%
"
case "
$cpu_display
" in
"
info
") prin "
${
subtitle
}
Usage
:
${
cpu_usage
}
" ;;
"
bar
") prin "
${
subtitle
}
Usage
:
$(
bar
"
${
cpu_usage
/
'%'
}
"
100
)
" ;;
"
infobar
") prin "
${
subtitle
}
Usage
:
${
cpu_usage
}
$(
bar
"
${
cpu_usage
/
'%'
}
"
100
)
" ;;
"
barinfo
") prin "
${
subtitle
}
Usage
:
$(
bar
"
${
cpu_usage
/
'%'
}
"
100
)
${
cpu_usage
}
" ;;
esac
unset cpu
}
}
# }}}
# }}}
...
@@ -1103,6 +1151,13 @@ getmemory () {
...
@@ -1103,6 +1151,13 @@ getmemory () {
memory=
"Unknown"
memory=
"Unknown"
;;
;;
esac
esac
# Progress bars
case
"
$memory_display
"
in
"bar"
) memory=
"
$(
bar
"
${
memused
}
"
"
${
memtotal
}
"
)
"
;;
"infobar"
) memory=
"
${
memory
}
$(
bar
"
${
memused
}
"
"
${
memtotal
}
"
)
"
;;
"barinfo"
) memory=
"
$(
bar
"
${
memused
}
"
"
${
memtotal
}
"
)
${
memory
}
"
;;
esac
}
}
# }}}
# }}}
...
@@ -1427,6 +1482,18 @@ getdisk () {
...
@@ -1427,6 +1482,18 @@ getdisk () {
# Put it all together
# Put it all together
disk="
${
disk_used
}
/
${
disk_total
}
(
${
disk_total_per
}
)
"
disk="
${
disk_used
}
/
${
disk_total
}
(
${
disk_total_per
}
)
"
# Add info bar
disk_used=
${
disk_used
/G
}
disk_used=
${
disk_used
/T
}
disk_total=
${
disk_total
/G
}
disk_total=
${
disk_total
/T
}
case "
$disk_display
" in
"
bar
") disk="
$(
bar
"
${
disk_used
/
'.'
}
"
"
${
disk_total
/
'.'
}
"
)
" ;;
"
infobar
") disk+="
$(
bar
"
${
disk_used
/
'.'
}
"
"
${
disk_total
/
'.'
}
"
)
" ;;
"
barinfo
") disk="
$(
bar
"
${
disk_used
/
'.'
}
"
"
${
disk_total
/
'.'
}
"
)
$disk
" ;;
esac
}
}
# }}}
# }}}
...
@@ -1456,18 +1523,23 @@ getbattery () {
...
@@ -1456,18 +1523,23 @@ getbattery () {
battery="
${
battery
}
%
"
battery="
${
battery
}
%
"
else
else
# If there's only a single battery and it's battery 0,
if [ "
${#
batteries
[@]
}
" -gt 1 ]; then
# don't number the subtitle.
unset battery
if [ "
${#
batteries
[@]
}
" == 1 ]; then
battery="
${
batteries
[0]
}
%
"
# Print each battery on a separate line.
for bat in "
${
batteries
[@]
}
"; do
case "
$battery_display
" in
"
bar
") prin "
${
title
}${
index
}
:
$(
bar
${
bat
/
'%'
}
100
)
" ;;
"
infobar
") prin "
${
title
}${
index
}
:
${
bat
}
%
$(
bar
"
${
bat
/
'%'
}
"
100
)
" ;;
"
barinfo
") prin "
${
title
}${
index
}
:
$(
bar
"
${
bat
/
'%'
}
"
100
)
${
bat
}
%
" ;;
*) prin "
${
title
}${
index
}
:
${
bat
}
%
" ;;
esac
index=
$((
index
+
1
))
done
return
return
fi
fi
# Print each battery on a separate line.
battery="
${
batteries
[0]
}
%
"
for bat in "
${
batteries
[@]
}
"; do
prin "
${
title
}${
index
}
:
${
bat
}
%
"
index=
$((
index
+
1
))
done
fi
fi
else
else
battery="
None
"
battery="
None
"
...
@@ -1509,6 +1581,12 @@ getbattery () {
...
@@ -1509,6 +1581,12 @@ getbattery () {
battery+="
%
"
battery+="
%
"
;;
;;
esac
esac
case "
$battery_display
" in
"
bar
") battery="
$(
bar
${
battery
/
'%'
}
100
)
" ;;
"
infobar
") battery="
${
battery
}
$(
bar
"
${
battery
/
'%'
}
"
100
)
" ;;
"
barinfo
") battery="
$(
bar
"
${
battery
/
'%'
}
"
100
)
${
battery
}
" ;;
esac
}
}
# }}}
# }}}
...
@@ -1661,7 +1739,6 @@ getcols () {
...
@@ -1661,7 +1739,6 @@ getcols () {
# }}}
# }}}
# }}}
# }}}
...
@@ -2333,6 +2410,23 @@ esac
...
@@ -2333,6 +2410,23 @@ esac
# }}}
# }}}
# Progress Bars {{{
bar() {
# Get the values
elapsed=
$((
$1
*
progress_length
/
$2
))
# Create the bar with spaces
prog=
$(
printf
%
"
$elapsed
"
s
)
total=
$(
printf
%
"
$((
progress_length
-
elapsed
))
"
s
)
# Set the colors and swap the spaces for
$progress_char
bar="
\0
33[38
;
5
;
${
progress_color_elapsed
}
m
${
prog
// /
$progress_char
}
"
bar+="
\0
33[38
;
5
;
${
progress_color_total
}
m
${
total
// /
$progress_char
}
"
printf "
%b%s
\n
" "
${
bar
}${
clear
}
"
}
# }}}
# }}}
# }}}
...
@@ -2392,6 +2486,22 @@ usage () { cat << EOF
...
@@ -2392,6 +2486,22 @@ usage () { cat << EOF
--block_range start end Range of colors to print as blocks
--block_range start end Range of colors to print as blocks
Progress Bars:
--progress_char char Character to use when drawing progress bars.
--progress_length num Length in spaces to make the progress bars.
--progress_colors num num Colors to make the progress bar. Set in this order:
elapsed, total
--cpu_display mode1 mode2 Which shorthand to use and how CPU usage should be printed
mode1 takes: name, speed, tiny, on, off
mode2 takes: info, bar, infobar, barinfo
--memory_display mode Which way should the memory progress bar be added
Takes bar, infobar, barinfo
--battery_display mode Which way should the battery progress bar be added
Takes bar, infobar, barinfo
--disk_display mode Which way should the disk progress bar be added
Takes bar, infobar, barinfo
Image:
Image:
--image type Image source. Where and what image we display.
--image type Image source. Where and what image we display.
Possible values: wall, shuffle, ascii,
Possible values: wall, shuffle, ascii,
...
@@ -2508,6 +2618,21 @@ while [ "$1" ]; do
...
@@ -2508,6 +2618,21 @@ while [ "$1" ]; do
--block_range) start=
$2
; end=
$3
;;
--block_range) start=
$2
; end=
$3
;;
--block_width) block_width="
$2
" ;;
--block_width) block_width="
$2
" ;;
# Progress Bars
--progress_char) progress_char="
$2
" ;;
--progress_length) progress_length="
$2
" ;;
--progress_colors)
progress_color_elapsed="
$2
"
progress_color_total="
$3
"
;;
--cpu_display)
cpu_shorthand="
$2
"
cpu_display="
$3
"
;;
--memory_display) memory_display="
$2
" ;;
--battery_display) battery_display="
$2
" ;;
--disk_display) disk_display="
$2
" ;;
# Image
# Image
--image)
--image)
image="
$2
"
image="
$2
"
...
@@ -2557,6 +2682,7 @@ while [ "$1" ]; do
...
@@ -2557,6 +2682,7 @@ while [ "$1" ]; do
# Stdout
# Stdout
--stdout)
--stdout)
unset info_color colors
unset info_color colors
unset -f bar
case "
$2
" in
case "
$2
" in
"
--
"* | "") echo "
--stdout
requires at least one argument
"; exit ;;
"
--
"* | "") echo "
--stdout
requires at least one argument
"; exit ;;
*) shift; args=("
$@
"); config="
off
"; stdout ;;
*) shift; args=("
$@
"); config="
off
"; stdout ;;
...
...
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