Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ActivityWatch watcher [time tracker] to community-plugins.json #1544

Merged
merged 3 commits into from
Mar 2, 2023

Conversation

LordGrimmauld
Copy link
Contributor

@LordGrimmauld LordGrimmauld commented Jan 15, 2023

Add a plugin to track time spent in Obsidian tracking info like vault and file names.

I am submitting a new Community Plugin

Repo URL

Link to my plugin:
https://github.com/LordGrimmauld/aw-watcher-obsidian

Release Checklist

  • I have tested the plugin on
    • Windows
    • macOS
    • Linux
    • Android (if applicable)
    • iOS (if applicable)
  • My GitHub release contains all required files
    • main.js
    • manifest.json
    • styles.css (optional)
  • GitHub release name matches the exact version number specified in my manifest.json (Note: Use the exact version number, don't include a prefix v)
  • The id in my manifest.json matches the id in the community-plugins.json file.
  • My README.md describes the plugin's purpose and provides clear usage instructions.
  • I have read the tips in https://github.com/obsidianmd/obsidian-releases/blob/master/plugin-review.md and have self-reviewed my plugin to avoid these common pitfalls.
  • I have added a license in the LICENSE file.
  • My project respects and is compatible with the original license of any code from other plugins that I'm using.
    I have given proper attribution to these other projects in my README.md.

Add a plugin to track time spent in Obsidian tracking info like vault and file names.
@github-actions
Copy link

Hello LordGrimmauld!

I found the following errors in your plugin, Obsidian watcher for ActivityWatch:

❌ Plugin ID mismatch, the ID in this repo is not the same as the one in your repo.


This check was done automatically.

Fixed plugin id in my local releases, this should bump the bot.
@LordGrimmauld LordGrimmauld changed the title Add Obsidian watcher plugin to community-plugins.json Add ActivityWatcher watcher [time tracker] to community-plugins.json Jan 16, 2023
@LordGrimmauld LordGrimmauld changed the title Add ActivityWatcher watcher [time tracker] to community-plugins.json Add ActivityWatch watcher [time tracker] to community-plugins.json Jan 16, 2023
@LordGrimmauld
Copy link
Contributor Author

Update: Testing on Windows shows this working. I am not in a position to test macOS, but considering all APIs this depends on should be available there too I'll assume it working until I receive a report that says otherwise.

@liamcain
Copy link
Collaborator

  • app this is referencing the global app instance. You should reference app via this.app
  • create So, it's a bit weird, but the create event is actually fired when the vault is initialized. So this will lead to a huge surge of calls with each file in your vault. You should add a onLayoutReady callback and subscribe to create after the vault is done initializing.
  • sleeptime maybe add a check to make sure that sleeptime isn't 0 to avoid sending heartbeats constantly (I see it's not configurable, so maybe this is just a future improvement)
  • oldPath oldPath is only the argument name for rename
  • sendHeartbeatData why are these passed as heartbeats? Shouldn't only the 5 second heartbeat be sent as a heartbeat and the file events are something else?
  • create just a heads up, create is also called for folders. You might want to check to make sure its a file and not a folder.

LordGrimmauld added a commit to LordGrimmauld/aw-watcher-obsidian that referenced this pull request Feb 23, 2023
- fixed bug where file creations would be spammed on loading a vault
- no longer relying on global app instance
- renamed sendHeartbeatData to sendData to be more accurate
- added sleep time check to assure sleep time is a positive number
- renamed leftover parameter names from copy/pasting various file event
- misc cleanup
Plugin review can be tracked at obsidianmd/obsidian-releases#1544
@LordGrimmauld
Copy link
Contributor Author

  • All references to the global app instance have been replaced
  • Thank you for bringing that weirdness with create to my attention. That definitely was a bug that needed addressing! I could both confirm and fix this.
  • sleeptime is currently not configurable mainly because i did not yet find a nice way to have the user enter numbers into config fields. If there is something i just missed, do let me know, as it is on my list of things to do. A sanity check is a good idea either way, so that has been added, if for now only to future-proof.
  • oldPath was an artifact left over by copy/pasting the other very similar file events and has been cleaned up.
  • sendHeartbeatData: According to ActivityWatch contributors, sending zero-duration "heartbeats" is a valid way to send events that interrupt the timeline at that point in time, which is what i want. After a rename, the file should no longer appear as being active under the old name. The naming however was hard to understand, the function has therefore been renamed to just sendData.
  • create being triggered on folders as well as files is not wrong. In fact i quite like it that way, there is no reason why folders should not be tracked.

Thank you for the thorough review, and after the changes i made i am looking forward to see this approved.

@github-actions
Copy link

github-actions bot commented Mar 2, 2023

Hello!

I found the following issues in your plugin submission

Errors:

❌ Please don't use the word Obsidian at the start of your plugin name since it's redundant and makes it harder to sort the plugin list.
❌ Plugin name mismatch, the name in this PR (Obsidian-compatible Watcher for ActivityWatch) is not the same as the one in your repo (ActivityWatch). If you just changed your plugin name, remember to change it in the manifest.json in your repo and your latest GitHub release.


This check was done automatically. Do NOT open a new PR for re-validation. Instead, to trigger this check again, make a change to your PR and wait a few minutes, or close and re-open it.

@liamcain liamcain merged commit c034bc5 into obsidianmd:master Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants