Hydra / Transient menu for different contexts ( personal / work / special-project )

A while ago I found interesting article about hydra menu for roam.

Main idea is to have contexts, they would have separate “capture”, “insert”, “find” keys

  • separate capture templates, possibly specify special directories for notes, or have only D&D specific templates for that context
  • preconfigured filtering for find and insert

Usage would be as follows:

  1. you can toggle hydra menu and quickly capture / search for a node from specific context
  2. in the hydra you can set “default” context, after that main keys for capture / search would switch to that context instead of “all”

I copied it to my config in order to have work notes stored in a separate directory that’s excluded from syncing, so that they are not leaving work notebook, while personal are shared between machines.
And while learning Transient I’ve written functinally same menu in transient

Maybe someone will find that useful.

Hydra menu contexts are done with macros that defines separate “capture”, “insert”, “find” functions for each context from it’s definition/configuration.
And subject switch is done by remapping keys in the “toggle-roam-subject-filter”

Transient menu works in functionally same way by storing “context” in a variable, while “capture”, “insert” and “find” lookup that variable and use ‘filter-fn’ and ‘templates’ from corresponding subject/context configuration