I am trying to create a Chrome extension (or app) for Chrome OS that monitors the foreground app that the user is currently interacting with.
For example if the user:
- plays Angry Birds for a few minutes; then
- browses some web pages using Chrome and finally
- does some calculations using the Calculator
then I want my extension (or app) to be able to detect and respond to these three transitions as they occur. Ideally the information about the app that I'd like to capture is either the app name (e.g. "Angry Birds") and/or the app id (e.g. com.somecompany.someapp).
I already experimented with several of the chrome.* API's but so far I haven't had any luck:
chrome.windows
andchrome.tabs
can only enumerate browser windows/tabs (not those of apps).chrome.app.window
can only enumerate windows that are part of it's own app (not other apps).- Apps are only sent their own
chrome.app.runtime
lifecycle events and not those of other apps. - I might be able to use OCR on the screen cast provided by
chrome.desktopCapture
but I would probably have to write specific code for each app that I want to support and it would be very CPU intensive.
I have had luck doing similar work on other platforms (Windows, Mac, Linux and even Android) using accessibility client API's (same API's used by screen readers for disabled people). Unfortunately Chrome OS doesn't appear to facilitate 3rd party accessibility clients.