~torresjrjr/fetch

015c94bcd508cd0fa74ed9eb6dfcd8d60a447e68 — Byron Torres 1 year, 4 days ago 9281b99
Use ps formatting to simplify 0b0e927 & 81812e8
1 files changed, 5 insertions(+), 3 deletions(-)

M fetch
M fetch => fetch +5 -3
@@ 59,13 59,15 @@ _shell() {
	printf "$1"  "$(readlink /proc/$PPID/exe)"
}
_sshd() {
	pids=$(ps ax | awk '!/awk/ && /sshd/ {printf $1 "   "}')
	pids=$(ps axc -o 'pid,cmd' | awk '/sshd/{printf $1 "   "}')
	printf "$1"  "${pids:---}"
}
_tmux() {
	ps ax | grep -v 'grep' | grep -q 'tmux' && tmux_sessions=$(
	ps axc -o 'cmd' | grep -q 'tmux: server' && tmux_sessions=$(
		tmux ls -F "#{session_created} #{?session_attached,$ul,}#S:#{session_windows}$c0" \
		| sort | awk '{printf $2 "   "}' | xargs -0 printf
		| sort \
		| awk '{printf $2 "   "}' \
		| xargs -0 printf
	)
	printf "$1"  "${tmux_sessions:---}"
}