Thanks for the clarification and the script! I had a few issues with it, and made the slight changes below to get it working and to give more whitespace in the tray
EDIT: Made the xl output more human-friendly!
#!/bin/bash
set -euo pipefail
/usr/bin/renice -n 19 $$ > /dev/null 2>&1
pattern='s/Mem:(\s*[0-9.a-zA-Z]+){2}\s*([0-9\.a-zA-Z]+).*/\2/g'
free_mem=$(/usr/bin/free --human | \
head --lines=2 | \
tail --lines=1 | \
sed -r "${pattern}")
pattern='s/Swap:(\s*[0-9.a-zA-Z]+){1}\s*([0-9\.a-zA-Z]+).*/\2/g'
used_swap=$(/usr/bin/free --human | \
head --lines=3 | \
tail --lines=1 | \
sed -r "${pattern}")
printf " %s [%s] %s" "$((`xl info | grep free_memory | sed 's/^.*:\([0-9]*\)/\1/'` / 1000))Gi" "${free_mem}" "${used_swap} "