Cross-platform window-Watcher for Linux (X11), macOS, Windows.
To log current window title the teminal needs access to macOS accessibility API. This can be enabled in System Preferences > Security & Privacy > Accessibility, then add the Terminal to this list. If this is not enabled the watcher can only log current application, and not window title.