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
5b1f273d
Commit
5b1f273d
authored
Jan 06, 2017
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disk: Add disk_show
parent
aed21c44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
14 deletions
+41
-14
neofetch
neofetch
+41
-14
No files found.
neofetch
View file @
5b1f273d
...
...
@@ -1622,20 +1622,32 @@ get_disk() {
*) df_flags=(-P -h) ;;
esac
# Get the info for "/".
disks=($(df "${df_flags[@]}" /)) || { err "Disk: '
df
' exited with error code 1"; return; }
# Put it all together.
disk_perc="${disks[11]/'
%
'}"
disk="${disks[9]/i} / ${disks[8]/i} (${disk_perc}%)"
# Bar.
case "$disk_display" in
"bar") disk="$(bar "$disk_perc" "100")" ;;
"infobar") disk+=" $(bar "$disk_perc" "100")" ;;
"barinfo") disk="$(bar "$disk_perc" "100") $disk" ;;
"perc") disk="${disk_perc}% $(bar "$disk_perc" "100")" ;;
esac
# Create an array called '
disks
' where each element is a separate line from
# df'
s output. We
then
unset
the first element which removes the column titles.
readarray disks < <
(
df
"
${
df_flags
[@]
}
"
"
${
disk_show
[@]
:-
/
}
"
)
&&
unset
'disks[0]'
# Stop here if 'df' fails to print disk info.
[[
-z
"
${
disks
[@]
}
"
]]
&&
\
{
err
"Disk: df failed to print the disks, make sure the disk_show array is set properly."
;
return
;
}
for
disk
in
"
${
disks
[@]
}
"
;
do
# Create a second array and make each element split at whitespacw this time.
disk_info
=(
$disk
)
disk_perc
=
"
${
disk_info
[4]/
'%'
}
"
disk
=
"
${
disk_info
[2]/i
}
/
${
disk_info
[1]/i
}
(
${
disk_perc
}
%)"
# Bar.
case
"
$disk_display
"
in
"bar"
)
disk
=
"
$(
bar
"
$disk_perc
"
"100"
)
"
;;
"infobar"
)
disk+
=
"
$(
bar
"
$disk_perc
"
"100"
)
"
;;
"barinfo"
)
disk
=
"
$(
bar
"
$disk_perc
"
"100"
)
$disk
"
;;
"perc"
)
disk
=
"
${
disk_perc
}
%
$(
bar
"
$disk_perc
"
"100"
)
"
;;
esac
# Append '(disk mount point)' to the subtitle.
prin
"
${
subtitle
}
(
${
disk_info
[5]
}
)"
"
$disk
"
done
}
get_battery
()
{
...
...
@@ -3531,6 +3543,10 @@ INFO:
--gtk3 on/off Enable/Disable gtk3 theme/font/icons output
--shell_path on/off Enable/Disable showing
\$
SHELL path
--shell_version on/off Enable/Disable showing
\$
SHELL version
--disk_show value Which disks to display.
Takes: '/', '/dev/sdXX', '/path/to/mount point'
NOTE: Multiple values can be given. (--disk_show '/' '/dev/sdc1')
--ip_host url URL to query for public IP
--song_shorthand on/off Print the Artist/Title on separate lines
--install_time on/off Enable/Disable showing the time in Install Date output.
...
...
@@ -3695,6 +3711,17 @@ get_args() {
[[
"
$cpu_temp
"
==
"on"
]]
&&
cpu_temp
=
"C"
;;
"--disk_show"
)
unset
disk_show
for
arg
in
"
$@
"
;
do
case
"
$arg
"
in
"--disk_show"
)
;;
"-"
*
)
break
;;
*
)
disk_show+
=(
$arg
)
esac
done
;;
"--disable"
)
for
func
in
"
$@
"
;
do
case
"
$func
"
in
...
...
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