There are a lot of actions to enable/disable groups available, which you can use with a logic block to get your result. The only thing is, your group names must be organized well.
Example:
If you execute your command to activate the "exclusive keyboard group", the logic block will check if the xbmc process is running and it's true, it enable the XBMC group - if it's false, the group will be disable.
I'm not sure what you mean by the "deactivated group" with
off and
always offbut it is possible that I misunderstand you