I’m making a change to the interface and I’d like to make the sidebar open automatically if the storyriver is empty.
In fact I removed from $:/core/ui/TopBar/menu
(which by default only contains the small button that changes the sidebar state by manipulating the contents of $:/state/sidebar
) the $:/tags/TopBar/menu
tag because I put an identical one not in the TopBar but in the EditToolbar and in the ViewToolbar.
I especially wanted to remove it from the TopBar because it interfered with other buttons if I was on mobile (usually overlapping the “close tiddler” button) Obviously, however, if no tiddler is open and the sidebar is hidden, without that button I would be stuck, so I would like the sidebar to open automatically.
I’ll stop digressing, and get to the point: I’m trying to make an action happen if a condition is met i.e. in this case to do this: <$action-setfield $tiddler="$:/state/sidebar" $field="text" $value="yes"/>
if the StoryRiver is empty (I thought of checking this with this filter: [list<tv-story-list>count[]]compare:number:eq[0]]
)
But I don’t know how to combine the two.
<$action-setfield $tiddler="$:/state/sidebar" $field="text" $value="yes"/>
Could be made into a macro, I did a bit of experimenting with various tools that I thought might help using that as a macro although I still can’t create that cause and effect relationship