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
72c7046a
Commit
72c7046a
authored
Dec 02, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache: Move cache file source to info function
parent
b36528dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
neofetch
neofetch
+18
-23
No files found.
neofetch
View file @
72c7046a
...
@@ -919,12 +919,6 @@ get_cpu_usage() {
...
@@ -919,12 +919,6 @@ get_cpu_usage() {
}
}
get_gpu
()
{
get_gpu
()
{
# Use cache if it exists
if
[[
-
f
"
${
cache_dir
}
/neofetch/gpu"
]]
;
then
source
"
${
cache_dir
}
/neofetch/gpu"
return
fi
case
"
$os
"
in
case
"
$os
"
in
"Linux"
|
"GNU"
)
"Linux"
|
"GNU"
)
gpu
=
"
$(
PATH
=
"/sbin:
$PATH
"
lspci
-mm
|
awk
-F
'\\"|\\" \\"'
'/Display|3D|VGA/ {print $3 " " $4}'
)
"
gpu
=
"
$(
PATH
=
"/sbin:
$PATH
"
lspci
-mm
|
awk
-F
'\\"|\\" \\"'
'/Display|3D|VGA/ {print $3 " " $4}'
)
"
...
@@ -1733,23 +1727,17 @@ get_local_ip() {
...
@@ -1733,23 +1727,17 @@ get_local_ip() {
}
}
get_public_ip
()
{
get_public_ip
()
{
# Use cache if available
if
type
-
p dig
>/
dev/null
;
then
if
[[
-
f
"
${
cache_dir
}
/neofetch/public_ip"
]]
;
then
public_ip
=
"
$(
dig +time
=
1 +tries
=
1 +short myip.opendns.com @resolver1.opendns.com
)
"
source
"
${
cache_dir
}
/neofetch/public_ip"
[[
"
$public_ip
"
=
~
^
\;
]]
&&
unset
public_ip
fi
else
if
type
-
p dig
>/
dev/null
;
then
public_ip
=
"
$(
dig +time
=
1 +tries
=
1 +short myip.opendns.com @resolver1.opendns.com
)
"
[[
"
$public_ip
"
=
~
^
\;
]]
&&
unset
public_ip
fi
if
[[
-
z
"
$public_ip
"
]]
&&
type
-
p curl
>/
dev/null
;
then
if
[[
-
z
"
$public_ip
"
]]
&&
type
-
p curl
>/
dev/null
;
then
public_ip
=
"
$(
curl
--max-time
10
-w
'\n'
"
$public_ip_host
"
)
"
public_ip
=
"
$(
curl
--max-time
10
-w
'\n'
"
$public_ip_host
"
)
"
fi
fi
if
[[
-
z
"
$public_ip
"
]]
&&
type
-
p wget
>/
dev/null
;
then
if
[[
-
z
"
$public_ip
"
]]
&&
type
-
p wget
>/
dev/null
;
then
public_ip
=
"
$(
wget
-T
10
-qO-
"
$public_ip_host
"
)
"
public_ip
=
"
$(
wget
-T
10
-qO-
"
$public_ip_host
"
)
"
fi
fi
fi
cache
"public_ip"
"
$public_ip
"
cache
"public_ip"
"
$public_ip
"
...
@@ -2355,8 +2343,15 @@ info() {
...
@@ -2355,8 +2343,15 @@ info() {
#
$1
is the subtitle
#
$1
is the subtitle
subtitle="
$1
"
subtitle="
$1
"
# Call the function and update variable
# Use cache if it exists
"
get_
${
2
:-
$1
}
" 2>/dev/null
if [[ -f "
${
cache_dir
}
/neofetch/
${
2
}
" ]]; then
source "
${
cache_dir
}
/neofetch/
${
2
}
"
else
# Call the function.
"
get_
${
2
:-
$1
}
" 2>/dev/null
fi
# Update the variable
output="
${
2
:-
$1
}
"
output="
${
2
:-
$1
}
"
# Trim whitespace
# Trim whitespace
...
...
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