Autoclose feature. Max 10 recent open tiddlers.

57 views
Skip to first unread message

Shareda

unread,
Oct 30, 2020, 6:55:22 AM10/30/20
to TiddlyWiki
Hello! Maybe someone knows some plugin doing something like this. If there are 10 tiddlers already open then the first one is closed automatically  when navigating to the 11th one. 

As I understand there should be navigate history and the navigate event to do that.  
Now I found the LinkCatcherWidget. But I'm not sure where I can get the list of recent navigations. Does anyone know that? Or how i can get that list from 

If I get it then I plan to 
1. Place the LinkCatcherWidget to the PageTemplate with
2. Filter [<nav_history>rest[10]] tiddlers
3. Apply WidgetMessage: tm-close-tiddler.

Is this a good plan?
 
That would be super great to forget about finding and closing old tiddlers.

TW Tones

unread,
Oct 30, 2020, 6:32:33 PM10/30/20
to TiddlyWiki
Shareda,

I tend not to need what you are asking for because I close unwanted tiddlers, use close others or close all as needed. 

However I can see how this may be useful. I have also made a tools to track the current sessions history.

In this case you are asking that on opening one tiddler it closes another. For this reason I suggest creating a button to do the opening and use that to open tiddlers and simultaneously close the "excess tiddler". You can use the link catcher to capture the name of the tiddler to open, then use its actions parameter to trigger open tiddler and the close.

Lets assume you are happy to use the story list this solution works, but since it will itself be closed I have put it in the sidebar 

Tag with $:/tags/SideBar
\define close-tiddler-action(tiddlername)
<$set name=tiddlername value="$(currentTiddler)$" emptyValue=<<currentTiddler>> >
<$action-sendmessage $message="tm-close-tiddler" $param="SampleWizard"/>
</$set>
\end
\define open-close-behind()
<$list filter="[enlist{$:/StoryList!!list}nth[3]]">
<$action-sendmessage $message="tm-close-tiddler" $param=<<currentTiddler>>/
>
</$list>
<$action-navigate $to=<<navigateTo>>/
>
\end

$
:/temp/last-opened=<$link to={{$:/temp/last-opened}}/>

<$linkcatcher to="$:/temp/last-opened" actions=<<open-close-behind>> >
{{TableOfContents}}
</$linkcatcher>

Note: 
  • for testing this closes the third, alter nth(3] to nth[10]
  • The close-tiddler-action definition is not in use
Regards
Tones
Reply all
Reply to author
Forward
0 new messages