fetch

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

commit 96fdce8824fee602f1f42ca1b167df1c4b2024d8
parent 62fc5caf79b78cccec5f41ca33cc791966c1a98c
Author: Byron Torres <b@torresjrjr.com>
Date:   Sat, 10 Apr 2021 01:06:20 +0100

Rewrite _tmux(), s/colours/formatters/, new $ul

Diffstat:
Mfetch | 30++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/fetch b/fetch @@ -7,7 +7,7 @@ main() { config - colours + formatters graphic reposition status @@ -66,13 +66,14 @@ _sshd() { } _tmux() { ps ax | grep -v 'grep' | grep -q 'tmux' && tmux_sessions=$( - tmux ls \ - | sed \ - -e 's/(created[^)]*)//' -e 's/(attached)/@/' \ - -e 's/windows/w/' -e 's/ //g' \ - | paste -s + tmux ls | paste -s | sed " + s/ windows (created[^)]*)//g + s/(attached)/$ul@$c0/g + s/ //g + s/\t/ /g + " ) - printf "$1" "${tmux_sessions---}" + printf "$1" "${tmux_sessions:---}" } _palette() { printf "\e[7m$c1 $c2 $c3 $c4 $c5 $c6 \e[m\n" @@ -87,14 +88,15 @@ config() { } -## Colours +## Formatters -colours() { - c0='\e[0m' - c1='\e[31m'; c2='\e[32m' - c3='\e[33m'; c4='\e[34m' - c5='\e[35m'; c6='\e[36m' - c7='\e[37m'; c8='\e[38m' +formatters() { + c0='\x1b[0m' + c1='\x1b[31m'; c2='\x1b[32m' + c3='\x1b[33m'; c4='\x1b[34m' + c5='\x1b[35m'; c6='\x1b[36m' + c7='\x1b[37m'; c8='\x1b[38m' + ul='\x1b[4m' }