Terminal, is Kodi being used

I’ve setup a script i wrote to run every hour. Its important the script runs but i find it slows down my HTPC when i am using it, and their is no big rush as long as it runs eventually.

Is there a way via script to tell if kodi is playing a video or better yet active in anyway (like browsing through the library…)

Ive looked into

Code:
kodi-send -a "Notification(, )";

but cant seem to find much in terms of getting status back.

I found an old post about idle detection but my box reports true on these conditions even when my HTPC has been untouched for hours.

any ideas? thanks,