Keyboards shortcuts

55 views
Skip to first unread message

Roma

unread,
Mar 7, 2025, 5:20:07 AMMar 7
to TiddlyWikiClassic
JumpKeysPlugin is very nice and, if not used all the time, increase ease and productivity.
In the same way, what I would appreciate is beneficing from other keyboard shortcuts. Although not essentials, I would use them a lot and may be other people would too. These are:

* Size for editing window: I set it to 10 only in txtMaxEditRows to fit on any poor size or resolution screen. But on other orientation (I like vertical orientation) or other resolution, I often increase the size of the window by mouse. Having 2 default sizes in AdvancedOptions and getting them enabled on tips of fingers would be really nice.

* I almost always work with tiddlers on tabs thanks to TiddlersBarPlugin Plugin. But sometimes the usual setup is useful. What I have to do is, using the mouse, click on some link to diable the tab function and on another one to display only the titles of the tiddlers in order to refresh the screen. Not sure one shortcut could swap from one display to the other?

* Refreshing is quite often needed, for instance to wake up aliases... Again, a shortcut would be better than going with the mouse.

This is what appears to me for the moment. Probably not easy to set up? Again, it's not fundamental. Just to share thoughts in case of...

R -

Yakov

unread,
Mar 15, 2025, 7:53:47 AMMar 15
to TiddlyWikiClassic
Hi Roma,

the repetitive tasks you've mentioned have quite different nature, so let me first share a few general notes/suggestions:
  1. If you know the JS that does the action you need, you can always automate keyboard handling like this:
    Say, we have a function doImportantStuff() { alert('yes, sir!') } which we'd like to run with a shortcut ctrl + shift + y.
    Than, a simple plugin will do the job:
    document.addEventListener('keydown', function(event) {
        if(e.key === 'e' && e.ctrlKey && e.shiftKey)
            doImportantStuff()
    })

    That being said, it's not always super-simple thing as you have to decide: keydown vs keyup, look up the modifies (like .ctrlKey for ctrl and for .shiftKey shift) and the key value, plus prevent defaults/propagation for hotkey conflicts, if they are present.
  2. There's a (somewhat outdated) plugin that should help with this: CaptureKeysMacro. Paired with my key options experiment, it can be improved further (simplified in terms of use), but you still need to know the function to use, to setup the thing. Ideally, the TW core should provide a list of such functions (commands) with descriptions, in this case we can even have a keyboard shortcuts manager, like VS Code and other dedicated software has. That requires an amount of work, but if we start from something small, we can improve things later.
As for your tasks:

3. Refreshing is not something that should be normally done manually: instead, it should be done by what introduces those aliases you've mentioned. There's in fact a number of refresh- functions in the core. Maybe it's a good idea to share more details and the plugin that introduces functionality that requires extra refreshing.

2. and 1. need to understand if there's already a JS function that does what you need: I suggest to start from 2. – if you have a function, try the suggestions from the general section above.

Best regards,
Yakov

пятница, 7 марта 2025 г. в 13:20:07 UTC+3, Roma:

Roma

unread,
Mar 18, 2025, 6:45:44 AMMar 18
to TiddlyWikiClassic
Great advices, thank you, Yakov! I will see that as soon as I have some more time... Meanwhile, and for those who can be interested, I've added to SideBarOptions (because at hand) <<option txtMaxEditRows>> so that, along with some zdefaultOptions where I set some "height", I can change it when needed in the side bar...

R -

Yakov

unread,
Mar 19, 2025, 3:26:57 AMMar 19
to TiddlyWikiClassic
While tweaking txtMaxEditRows instead of writing responsive CSS looks like a hack for me (for instance, because on a touch screen you don't usually have hotkeys anyway), let me suggest a simple solution based on what I've shown above:

const rowNumberNormal = 10
const rowNumberNarrow = 20
document.addEventListener('keydown', function(event) {
    if(e.key === 'e' && e.ctrlKey && e.shiftKey) { // adjust to whatever shortcut you want
        config.options.txtMaxEditRows =  config.options.txtMaxEditRows == rowNumberNormal
           ? rowNumberNarrow :  rowNumberNormal
    }
})

This plugin, when you press ctrl + shift + e, changes the setting to one of the 2 values (toggles between them).

By the way, you may also want to try this relatively new CSS style: field-sizing: content; (along with min/max-width and min/max-height) which grows a textarea or input based on the content inside it. Hmm.. may be it's worth considering that one for the core..

вторник, 18 марта 2025 г. в 13:45:44 UTC+3, Roma:
Reply all
Reply to author
Forward
0 new messages