Create a recording-icon in Polybar when screencast is active

I created a shortkey to start/ stop a screencast:

ctrl + Print
ffmpeg -y -f x11grab -s 1680x1050 -i :0.0 -f alsa -i default video.mp4

When the screencast is active I would like to have an icon on the polybar. How to create?

You’ll need some sort of script that can check whether the command is running or not.

For polybar, you can create a script type module


Thanks you. The concept behind it I can grasp. But that’s too sophisticated for my level. I see, I have to educate me for scripting…