fetch

MSYS2-compatible system info prompt
git clone https://git.torresjrjr.com/fetch.git
Log | Files | Refs | README | LICENSE

commit 72a71ce6b3519d5c799826874881ac20c063bdab
parent 9899b1e0ea1441be0175f983c35b7b5e9f237a8d
Author: Byron Torres <b@torresjrjr>
Date:   Mon, 21 Feb 2022 00:23:49 +0000

New _uptime() statusline; rm _kernal()

Diffstat:
Mfetch | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fetch b/fetch @@ -33,7 +33,7 @@ graphic() { status() { padding; _title "${c5}%s@%s ${c3}%s\n" padding; _os "${c6}os ${c0}%s\n" - padding; _kernel "${c6}kernel ${c0}%s\n" + padding; _uptime "${c6}uptime ${c0}%s\n" padding; _shell "${c6}shell ${c0}%s\n" padding; _sshd "${c6}sshd ${c0}%s\n" padding; _tmux "${c6}tmux ${c0}%s\n" @@ -47,10 +47,14 @@ _title() { env printf "$1" "$(whoami)" "$(uname -n)" "$(date -R)" } _os() { - env printf "$1" "$(uname -o)" + env printf "$1" "$(uname -o) $(uname -r)" } -_kernel() { - env printf "$1" "$(uname -sr)" +_uptime() { + s=$(cat /proc/uptime); s=${s%%.*} + stopwatch="$(env printf '%sd %sh %sm' \ + $(env printf '%s' "$s dd 86400/p3R 3600/24%p3R 60/60%p3R" | dc) + )" + env printf "$1" "$stopwatch (${s}s)" } _shell() { env printf "$1" "$(readlink /proc/$PPID/exe)"