Note syncing daemon for use with git
notesd will monitor whatever directory you specify in the configuration. Any time there is a filesystem event that also made the git tree dirty, it will add/remove/stage whatever was changed. It will then create a generic commit with the exact time according to your system. And finally push it to the repo your specified, all without manual intervention.
I wrote this just to keep some notes up to date when moving between workstations/personal machines. I'm leaving it out here for anyone to use.
Please check the Notes section below for some tips on usage.
go build -o notesd main.go
Copy the binary
notesd to wherever you want that's in your
$PATH. I use
Make the config directory:
And create or copy over the
example.yaml config as
~/.config/notesd/config.yaml and modify it to fit your setup.
api-key: "[key-goes-here]"- Example:
# Folders to watch # Make sure it initialize your repo before starting notesd folder: "~/Notes" # Force pull remote on start to get the latest updates force-pull: true # Git information git-repo: username: "distek" author: "distek" email: "email@example.com" api-key: "" ssh-user: "git"
Create a git repo on whatever service you want to use.
Rather clone or initialize that repo locally.
notesd configuraiton to reflect which directory it should monitor, and all necessary repo details.
Configure your DE/WM to run the binary on startup, or launch it later if you don't want it constantly monitoring the git directory.
For example: Sway/i3:
exec --no-startup-id notesd
Check the Notes section for information regarding SSH
This has been tested on the following systems:
Note on SSH:
#!/bin/bash eval $(ssh-agent) ssh-add notesd &
A note on directories and the files contained within:
notesd will not check to see if there were changes if it was not running at the time of the change. If you want it to see changes, you just need to
touch whatever files/directories you modified while it is running. You can also just add/commit/push changes yourself and any changes after notesd is started will be detected.
This is most notably an issue with directories and the files contained within.
notesd, and then modify a file in that directory, it will not notice the change.
touchthe directory first, and it will add everything recursively from there.
Please raise an issue in this repo with any errors you received, and we'll try and figure out what's going on. This should be pretty solid unless you misconfigured it.