#!/bin/bash
# pipeScreenfetch
# call from .config/openbox/menu.xml like
#
# header
header () {
cat << HEAD
HEAD
}
# footer
footer () {
cat << FOOT
FOOT
}
xmlescape () {
echo "$@" | sed 's/&/\&/g; s/\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g; s/^[ \t]*//;s/[ \t]*$//'
}
# checks critical
command -v screenfetch >/dev/null 2>&1 || { header; echo " "; footer ; exit 1; }
header
# items loop over lines
screenfetch-dev -nNE -d "-host;-shell" | while read -r line
do
#line=$(xmlescape "$line")
#sed replacement https://github.com/koalaman/shellcheck/wiki/SC2001
line="${line//_/__}"
echo "-
bash -c \"echo '$line' | /usr/bin/xsel --clipboard\"
"
done
footer