Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast mode? #742

Open
danwdart opened this issue Jan 31, 2022 · 1 comment
Open

Fast mode? #742

danwdart opened this issue Jan 31, 2022 · 1 comment

Comments

@danwdart
Copy link

I'm submitting a ... (check one with "x")

[ ] bug report
[ ] new distro request
[x] request

Can we have a fast mode so I can add it to .bashrc?
Is there some kind of caching system or just a mode to say "get only the things that won't take ages to get"?
Thanks!

@OPhamster
Copy link

OPhamster commented Mar 10, 2024

Ah I may be dodging your question here, but since I don't expect my information to change that often - I use a simple script to cache it on my end.

$ cat cached_screenfetch 
#!/bin/bash

# you could even keep this in a place that isn't scrubbed on reboots
SCREENFETCH_CACHE=/tmp/screenfetch.info
CAT_BIN=/usr/bin/cat

function read_from_cache { $CAT_BIN $SCREENFETCH_CACHE; }
# we don't want to see any errors and we want to wrap long lines
# short and sweet
function write_to_cache { screenfetch -E -w > $SCREENFETCH_CACHE; }

if [[ -f $SCREENFETCH_CACHE ]]
then
    read_from_cache
else
    write_to_cache
    read_from_cache
fi
# the first fresh screenfetch
$ time ./cached_screenfetch
# hiding the output
real    2m0.773s
user    0m0.692s
sys     0m0.448s

# successive calls
$ time ./cached_screenfetch 
 # hiding the output
real    0m0.009s
user    0m0.000s
sys     0m0.009s

Hopefully this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants