wakatime / macos-wakatime

Mac system tray app for automatic time tracking and metrics generated from your Xcode, Figma, Postman, etc. usage.
https://wakatime.com/mac
BSD 3-Clause "New" or "Revised" License
142 stars 23 forks source link

Add --category building when the current Xcode window is building #64

Closed starbugs closed 1 year ago

starbugs commented 1 year ago

Implements #20.

starbugs commented 1 year ago

Would this text be translated/localized depending on the user's language? The it wouldn't equal "Build".

Very good point that I completely didn't think about. I suppose the text will be localized. I will verify and look into possible solutions.

starbugs commented 1 year ago

@alanhamlett As per https://apps.apple.com/us/app/xcode/id497799835?mt=12 Xcode is currently only available in English. I also checked the Xcode.app bundle and it only contains en.lproj without any other translations. For now, I think this PR is "as safe as it gets" without much further effort. One way to make this more future proof would be to parse the Xcode app bundle and automate the string matching based on the results. However, I think even then there would be a chance that we might miss something, since people might have multiple Xcode versions installed using Xcodes for example.

Once Xcode is released with multi language support, this feature would have to be revised of course, but I think that's a good enough tradeoff for now.

I also looked into other methods as to how we could detect building (as a supporting measure for the current approach or as a replacement). One way would be to observe potential xcodebuild processes, but that would not suffice on its own to detect if the focused Xcode window is building. There might be a way to strengthen the approach in the future by including more factors though.