fetch

A MSYS2-compatible sys-info prompt
Log | Files | Refs | README | LICENSE

commit fd73490fd98f983b3bee990cfa03fbeba5ed1006
parent 1efcf5aa5390ac8a7877eda979c4ca48dbe0a73b
Author: Byron Torres <b@torresjrjr>
Date:   Sun, 31 Jan 2021 23:19:18 +0000

Format statusline functions, simplify _tmux()

Diffstat:
Mfetch | 41+++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/fetch b/fetch @@ -45,30 +45,35 @@ status() { ## Statuslines -_title() { printf "$1" "$(whoami)" "$(hostname)" "$(date -R)" ;} -_os() { printf "$1" "$(uname -o)" ;} -_kernel() { printf "$1" "$(uname -sr)" ;} -_shell() { printf "$1" "${SHELL}" ;} +_title() { + printf "$1" "$(whoami)" "$(hostname)" "$(date -R)" +} +_os() { + printf "$1" "$(uname -o)" +} +_kernel() { + printf "$1" "$(uname -sr)" +} +_shell() { + printf "$1" "${SHELL}" +} _sshd() { sshd_pids=$(ps | awk 'BEGIN{ORS=" "}; /sshd/{print $1}') printf "$1" "${sshd_pids:---}" } _tmux() { - if ps | grep tmux >/dev/null - then - tmux_sessions=$( - tmux ls \ - | sed \ - -e 's/(created[^)]*)//' -e 's/(attached)/@/' \ - -e 's/windows/w/' -e 's/ //g' \ - | paste -s - ) - else - tmux_sessions='--' - fi - printf "$1" "${tmux_sessions}" + ps | grep tmux >/dev/null && tmux_sessions=$( + tmux ls \ + | sed \ + -e 's/(created[^)]*)//' -e 's/(attached)/@/' \ + -e 's/windows/w/' -e 's/ //g' \ + | paste -s + ) + printf "$1" "${tmux_sessions---}" +} +_palette() { + printf "\e[7m$c1 $c2 $c3 $c4 $c5 $c6 \e[m\n" } -_palette() { printf "\e[7m$c1 $c2 $c3 $c4 $c5 $c6 \e[m\n" ;} ## Colours