I am trying to make an AFK script in python that work in Ubuntu.

Curent script will take runescape window to foreground every X minutes speificied in the scrpt. I want it alert me when potion timer runs out. Idea is to take screenshot, then use opencv or something like that to see if potion icon in screen or not.

First step is able to take screenshot of runescape windows while it is not active. I did google, don't find much info on how to do this on Ubuntu, there are some solution for Windows using win32 api. Anyone know how to do it on Ubuntu/Linux ?