grasp icon indicating copy to clipboard operation
grasp copied to clipboard

Adding support for multiple org files and multiple templates.

Open BlueBoxWare opened this issue 3 years ago • 0 comments

Hi, thank you for creating Grasp!

I wanted the ability to choose between multiple org files and multiple templates when capturing, so I added support for that. If you are interested, I can send a pull request. The changes are pretty major though, so I could imagine you rather not want to deal with that.

How it works: Org files can be configured by creating symlinks in ~/.config/grasp/files to the actual org files. Subdirectories are supported too, which also makes it possible to simply make ~/.config/grasp/files a link to your org directory.

Templates can be configured by placing them in ~/.config/grasp/templates. Files with a .txt extension are treated as simple text templates with the same syntax as the --template parameter. Files with a .py extension should contain a Python class with a method which creates the org text from the supplied data, like the --config parameter (but a bit more general).

Configuring can be done while the server is running, without restarting (when the popup is opened, the extension contacts the server, which sends back the actual content for the popup). The default org-file and default template can be optionally configured by creating appropriate symlinks in ~/.config/grasp. $XDG_CONFIG_HOME is respected. Using the --path, --template and --config parameters still works as expected when ~/.config/grasp/ doesn't exist or doesn't supply the necessary configuration.

BlueBoxWare avatar Aug 13 '22 17:08 BlueBoxWare