Created
October 5, 2019 21:35
-
-
Save aragaer/ed46ba7abb790072190686221f28fdf5 to your computer and use it in GitHub Desktop.
obs status for xmobar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOGS=/home/aragaer/.config/obs-studio/logs/ | |
get_status() { | |
result='---' | |
OBSPID=`ps ax | awk '\$5=="obs"{print \$1}'` | |
for pid in $OBSPID; do | |
file=`readlink -f /proc/$pid/fd/6` | |
if grep '==== Streaming St' "$file" | tail -1 | grep -q 'Streaming Start' ; then | |
result='LIVE' | |
break | |
fi | |
if grep '==== Recording St' "$file" | tail -1 | grep -q 'Recording Start' ; then | |
result='REC' | |
break | |
fi | |
done | |
echo $result | |
} | |
if [ "$1" = '--once' ] ; then | |
get_status | |
exit | |
fi | |
while :; do | |
get_status | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment