1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-04 16:03:13 +00:00
Dotfiles/.config/polybar/themes/monolit-dracula/polybar-scripts/info-taskspooler/info-taskspooler.sh

28 lines
737 B
Bash
Raw Normal View History

2020-07-27 04:59:00 +00:00
#!/bin/sh
# USAGE:
# No arguments: prints the job running/queued job count of the default tsp server
# Arguments: name,sock_name - one or more arguments, e.g. tsp yt,youtube p,podcasts
# sock_name is optional, will default to default tsp socket
# custom socket names will be generated as /tmp/ts-socket.SOCK_NAME, your TS_SOCKET will need to match
get_tsp_count() {
sock=/tmp/socket-ts.${1:-$(id -u)}
tsp_count=$(TS_SOCKET=$sock tsp|grep -E -c 'running|queued')
echo "${tsp_count:-0}"
}
# without argument, just show count of default socket
if [ $# -lt 1 ]; then
get_tsp_count
else
for t in "$@"; do
IFS=, read -r name sock_name <<- EOF
${t}
EOF
echo "${name} $(get_tsp_count "${sock_name}")"
done|sed 'N;s/\n/ /'
fi