Global keyboard shortcuts don't seem to work with <$action-navigate/>

67 views
Skip to first unread message

Hubert

unread,
Feb 12, 2019, 6:05:29 AM2/12/19
to TiddlyWiki
Hello,

I have a tiddler named Test tagged $:/tags/KeyboardShortcut and having ctrl+I in its key field.

Using the ctrl+I key combination I'm able to generate a notification using <$action-sendmessage $message="tm-notify" $param="bla"/> but I'm unable to use the same key combination to navigate to a tiddler titled Items using <$action-navigate $to="Items"/>.

I've tried using both the widget message tm-navigate and actionNavigate but had no luck. It appears that these actions are ignored by the keyborad shortcut mechanism.

I'd be grateful for help.

Many thanks!
Hubert

BurningTreeC

unread,
Feb 12, 2019, 6:58:14 AM2/12/19
to TiddlyWiki
Hi Hubert,

the Keyboard Shortcuts documentation at tiddlywiki.com contains some information about this at the very bottom of the tiddler
it's probably just missing an example to be clear enough, I think I'll add one ...

Here's how you do it:

<$navigator story="$:/StoryList" history="$:/HistoryList">


put your shortcut actions here


</$navigator>


it's necessary to wrap certain actions in Keyboard-Shortcut-Tiddlers within a navigator widget. Such a widget exists for tiddlers in the story river or sidebar through the $:/core/ui/PageTemplate tiddler, that transcludes all other PageTemplate tiddlers. but you can imagine Keyboard-Shortcut-Tiddlers being outside of the scope of that navigator widget, so we need to explicitely tell it the storylist and historylist it should use for navigation - then it works

note that if your storylist and historylist are not the standard lists, you'd use those tiddlers for the "story" and "history" attributes, but I guess that in 95% of the cases the standard ones will do the job

all the best,
btc

BurningTreeC

unread,
Feb 12, 2019, 7:04:39 AM2/12/19
to TiddlyWiki
I forgot mentioning that for navigation using the action-navigate widget or the tm-navigate message I use navigator widget with more attributes, exactly how the $:/core/ui/PageTemplate tiddler does it, so that navigation also behaves the same way as clicking a navigation button or link within the story-river or sidebar:

<$navigator story="$:/StoryList" history="$:/HistoryList" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>




Hubert

unread,
Feb 12, 2019, 7:20:08 AM2/12/19
to TiddlyWiki
Thank you! That solves it :)

Hubert

unread,
Feb 12, 2019, 8:18:34 AM2/12/19
to TiddlyWiki
Follow-up question: I'd like to limit the scope of certain keyboard shortcuts to certain tiddlers only. Am I correct in saying that this would come down to encapsulating a keyboard shortcut definition within a list filter, like for instance [is[current]title[something]] would make the keyboard definition only available within a tiddler titles 'something'?

Thanks.

BurningTreeC

unread,
Feb 12, 2019, 10:00:06 AM2/12/19
to TiddlyWiki
Follow-up question: I'd like to limit the scope of certain keyboard shortcuts to certain tiddlers only. Am I correct in saying that this would come down to encapsulating a keyboard shortcut definition within a list filter, like for instance [is[current]title[something]] would make the keyboard definition only available within a tiddler titles 'something'?


Sadly, it doesn't work that way. Currently there's no way to identify the "current tiddler" from within a global keyboard shortcut by the <<currentTiddler>> variable or [all[current]] etc.

The problem graphically looks like this:



HERE STARTS THE TIDDLYWIKI

    here is my global keyboard shortcut. it starts and ends here. it has access to variables defined above it (no user-defined variables, mostly core-tiddlywiki stuff) or imported variables/macros (using \import or <$importvariables>), but nothing below.

        here starts the "visible" part of the tiddlywiki

            here starts the story river. from here to the point where the story river ends, the <<currentTiddler>> variable holds the title of each visible tiddler
        
                tiddler 1, currentTiddler="tiddler 1"

                tiddler 2, currentTiddler="tiddler 2"

            here the story river ends.

        here ends the "visible" part of the tiddlywiki

HERE ENDS THE TIDDLYWIKI



That means, to do something on a single tiddler using a global keyboard shortcut, we currently have to specify that tiddler title directly

There are some ideas how to "detect" the tiddler that's most probably the currently viewed tiddler:

    * using the dynaview plugin like in the dynaview demo (https://tiddlywiki.com/plugins/tiddlywiki/dynaview/) and filtering the visible tiddlers in the story-river, sorting them from top to bottom, using only the first
    * adding a mechanism to the core that sets a state-tiddler to the title of the navigated tiddler, whenever a navigation occurs (we could transclude that tiddler in global keyboard shortcuts)

... but we don't have anything useful implemented in the core at the moment


hope this helps

Hubert

unread,
Feb 12, 2019, 10:10:08 AM2/12/19
to TiddlyWiki
Thanks for your in-depth explanation.

That means, to do something on a single tiddler using a global keyboard shortcut, we currently have to specify that tiddler title directly

Could you perhaps point me to how this could be achieved?

I've no problem defining tiddler titles explicitly. I've rephrased my question here.
Reply all
Reply to author
Forward
0 new messages