Is there any way to monitor if a X session is inactive for i.e 10 minutes? And I would execute a command when it happens, like a screensaver, but it's not a screensaver in this case.
For gnome-screensaver, check out this page. He has a python script which hooks up to the screensaver events to run commands.
Also xscreensaver has an option you can use in a script to react to screensaver events (look for -watch option)
Set the screensaver to do nothing on activation if you don't actually want the screensaver to kick in, and you're done.