How do I manage to switch Notebooks

I use this to easily switch my Notebooks

title: $:/mau/CustomNS/ui/switch-db
caption: PouchDB
tags: $:/tags/SideBar
type: text/vnd.tiddlywiki

\define switch-db()
<$action-sendmessage $message="tm-TP-config-selectedDb" $param={{$:/temp/tiddlypouch/selected-db}}/>
<$action-deletetiddler $tiddler="$:/temp/tiddlypouch/selected-db"/>
<$action-sendmessage $message="tm-TP-config-updateSelectedDB"/>

Change notebook: 
<$select tiddler="$:/temp/tiddlypouch/selected-db" default={{$:/plugins/danielo515/tiddlypouch/config/config_database##selectedDbId}} actions=<<switch-db>> >
<$list filter="[list[$:/plugins/danielo515/tiddlypouch/config/database_names]]" variable="db-name">
<option><$text text=<<db-name>>/></option>
,,''Note:'' selecting a different notebook will cause NoteSelf to be reloaded,,

It works fine with two limitations:

  • I did not find a way to get rid of the annoying message: “Configuration has been changed and saved. It is necessary to reload the window. Are you Ok with it?” which requires a useless confirmation (IMO this warning only makes sense while adding a new config in the settings panel)

  • The tiddler needs to be added once to every notebook since it is stored in the db.

Both the issues are beyond my Tiddlywiki programming skills. I did not make a PR. Too much effort for a quick’n’dirty workaround. Use it as is if you would like or feel free to modify it and create a better version.


1 Like