I’m developing a TextMate bundle for WakaTime . It seems as though sufficient functionality is available now with Semantic Classes “callback.document.did-open” and “callback.application.did-activate” to trigger a call to the wakatime-cli . (The goal here is to replace the WakaTime.tmplugin  which relies on a now-deprecated Python implementation of the WakaTime API, written in Python 2).
Cliff’s Notes on WakaTime: a shell script that can be called to update a web service with how much time has been spent viewing/editing a particular document.
The challenge I’m running into is that the Semantic Classes are triggering my tmCommand for every open window, and I’d like to limit that to the frontmost active tab.
TM_SELECTED_FILE doesn’t cut it, and TM_FILENAME, when populated, returns a value for the active tab of every open window.
I’ve started exploring AppleScript to get the frontmost window’s name and comparing that … but that’s a road I really don’t want to go down.
Is there another approach that I am just not seeing? I have looked through the source for “callback.document” and have dug into OakTabBarView looking for environment variables that may be set to indicate which window & tab is frontmost, and have also looked at the output from $TM_QUERY … and am not finding it anywhere.
Perhaps that’s the plugin I need to write to enable the behavior I want? Objective-C is sort of the final frontier for me, so I can go down that road … but will have questions. :)
Thanks in advance!
Best regards, Clay