A script that grabs the name of the current song played in osu! and saves it into a text file to be used in obs.
while sleep 1; do
osuwindowname=$(xdotool search --classname 'osu\!.exe' search --name "osu" getwindowname|awk 'sub(/^.{8}/,"")');
echo "$osuwindowname" > songname.txt;
done
Example here CLICK ME