Hi Kevin, 

I was looking for the same solution for a while and found something... 
emmm, sort of cheating. 

   1. My TiddlyWiki story view is "Zoom In", so there is only one tiddler 
   surfaced at one time;
   2. I noticed the tiddler close button [X] always appears at a fix 
   position (X1415, Y220 on my screen), if the tiddler is short (i.e. no 
   scrolling of the window); 
   3. If the tiddler is long, when [Home] key is pressed, the [X] appears 
   are the same position;
   4. AutoHotKey <https://www.autohotkey.com/> can be used to send 
   virtual  keystroke and mouse operation (e.g. move the cursor to somewhere 
   and click);
   5. Hence the idea is: once a keystroke (i.e. "Alt + X") is pressed > 
   trigger a piece of AutoHotKey script > Send [Home] key > Move cursor to [X] 
   position > left click

Here is the script, I am using "control + space bar" to fire it: 
; Comment: Use to close tiddler in tiddlywiki
; Comment: Uses [ctrl] + [space] to trigger 
^Space::
SendInput, {Home}
Sleep, 200   ; wait for 0.2s, the page goes up
MouseClick, left, 1415, 220 ;[X] button position in px on the screen
return 


Used commands 

   - SendInput <https://autohotkey.com/docs/commands/Send.htm>
   - Sleep <https://autohotkey.com/docs/commands/Sleep.htm>
   - MouseClick <https://autohotkey.com/docs/commands/MouseClick.htm>
   
revise "^Space" to your preferred key combination: 

   - 
   - ; ! = Alt
   - ; ^ = Control
   - ; + = Shift
   - ; # = WindowsKey
   - ; other example: [Ctrl] + [Shift] + [a] = ^+a

Hope it helps. ;-) 

On Sunday, April 8, 2018 at 8:49:36 AM UTC+8, Kevin Kleinfelter wrote:
>
> 99% of the way there.  In addition to what I said before:
>
>    - I added tabindex="1" to the div in ViewTemplate.  This makes it 
>    possible to select a view-mode tiddler.
>    - I wrapped the div with: <$keyboard key="alt-W" 
>    message="tm-close-tiddler">
>
> I also had to edit $:/config/Search/AutoFocus (shadow tiddler) and set it 
> to: false
>
> I'm still not there.  Focus often winds up on the document body. 
>  (Verified via running some JavaScript in the browser console.)
>
> I need to add an onFocus to the body, which does a setFocus to the first 
> story div.  The only way I know to do that would be to edit 
> $:/core/templates/tiddlywiki5.html 
> <http://localhost:8080/#%24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.html> .
>
> Can anyone suggest a "tiddlywiki style" way to shift focus from the 
> document body to the first story in the river?
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b5dac02c-33e1-4ff4-91af-5c633f1acd06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to