I found that for personal use, I want my TiddlyWiki to always open with the Open tab selected. Every time I had it on Recent when I saved & closed TW, I found myself manually switching back to Open.
Let’s change that so TW always expands the Open tab the next time you open your wiki!
EDIT: I have replaced my original solution with a smarter solution by Eric Shulman:
Eric's solution
Create a new tiddler, which can be called anything you like and enter \define publishFilter() -[prefix[$:/state/tab/sidebar]] in the body text
Go to Advanced Search for System tiddlers, either by:
Clicking/tapping and selecting the System tab, or
Navigating directly to $:/core/ui/AdvancedSearch/System
Enter $:/state/tab/sidebar in the search box. You will get an answer like $:/state/tab/sidebar--123456789. This number* could be unique to your wiki.
Copy the name of the whole tiddler like in the example I gave.
Create a new tiddler, call it whatever you would like.
I didn’t want to see this tiddler in search results, so I put it behind the $:/ namespace & named my tiddler $:/yan/Always open ‘Open’ sidebar tab on startup
Enter this into your new tiddler and replace the number with your wiki’s unique code <$action-setfield $tiddler=“$:/state/tab/sidebar–YOUR_NUMBER_HERE” $value=“$:/core/ui/SideBar/Open” />
Tag your tiddler with $:/tags/StartupAction**, save the tiddler, and save changes to your TiddlyWiki.
If you followed all the steps right, Open will be pre-selected the next time you open your TiddlyWiki, regardless of what tab you last had expanded when you saved your wiki.
I have a number of wikis that are meant for consumption by someone else. I aways want these to open in a consistent state, in which all menus are folded. In those, I go a little further than this, and delete all the $:/state/tab/sidebar-* entries. I set the text of $:/config/DefaultSidebarTab appropriately. (For my case, that’s TableOfContents. It sounds as though you would want $:/core/ui/SideBar/Open.)
In a $:/tags/StartupAction tiddler, I have something like this:
Note that $action-deletetiddler can also accept a $filter=... param for deleting multiple tiddlers. Thus, your StartupAction could be written more compactly as:
Oh, thank you. I’ve been copying and pasting this code for a few years now. I never really looked back at it until today. That’s a definite improvement!
I think there’s a strong case for introducing a new core setting to accomplish this. We could do it at a high level with a setting that entirely disables the saving of state tiddlers, or a more granular setting that just controls the sidebar tab behaviour.
Thank you for your response Jeremy. I did find a configuration tool under Settings after this post. It was already set to Open, but it wasn’t doing anything.
Following up, I tested this an empty.html of 5.3.6. I’m getting the same result for a single-file wiki; the tab is whatever it was when I last saved the wiki, instead of ‘Open’, which is the default setting for $:/config/DefaultSidebarTab.
A $:/state/tab/sidebar-... tiddler is automatically created as soon as you switch to a different sidebar tab. Note that this tiddler title is “qualified”, which means it gets a computed numeric value appended to the end of the title. If you look in the “more > system” tab, you will find something like $:/state/tab/sidebar--595412856 there.
The default value from $:/config/DefaultSidebarTab is only used if $:/state/tab/sidebar-... doesn’t exist. Thus, to force the default value from $:/config/DefaultSidebarTab to always be used at startup, you need to delete the qualified $:/state/tab/sidebar-... tiddler before your TiddlyWiki file is saved.
Fortunately, there is a VERY easy way to do this simply by creating a tiddler (e.g., “MyPublishFilter”), tagged with $:/tags/Global, containing the following text:
That’s it. From now on, whenever you save your TiddlyWiki file, this filter is applied to the list of tiddlers that are to be saved. Note the use of -[prefix[$:/state/tab/sidebar]] in the filter. This means that all tiddlers with the indicated title prefix (regardless of any “qualified” numeric suffix) will automatically be skipped (because of the leading “-” on the filter) when saving the TiddlyWiki file.
The result is that whenever you reload the file, the default value in $:/config/DefaultSidebarTab is always used, which achieves your goal. Note that this also eliminates the need to use a $:/tags/StartupAction tiddler to remove the $:/state/tab/sidebar-... tiddler.
Always thought “Open” tab should be the default on opening.
However, I just couldn’t get it to work for me. See Jim Carrey karate instructor (defense against the knife attack): “Like a lot of beginning students, you attacked me wrong. You’re supposed to come at me like this…”