deathbeds / jupyterlab-deck

Lightweight presentations for JupyterLab
https://jupyterlab-deck.rtfd.io
BSD 3-Clause "New" or "Revised" License
40 stars 9 forks source link

Enable PageUp / PageDown to support navigation with remote pointers #50

Open nthiery opened 1 year ago

nthiery commented 1 year ago

Elevator Pitch

Remote pointers typically send PageDown and PageUp events to navigate through slideshows. It would be therefore handy if jupyterlab-deck supported these shortcuts.

PageDown: display the next fragment/subslide/slide PageUp: display the previous fragment/subslide/slide

So presumably PageDown and PageUp could simply be aliased to space and shift-space (assuming I got their purpose correctly; see #49).

Thanks in advance!

bollwyvl commented 1 year ago

As it stands, these can already be customized through settings:

{
  "shortcuts": [
    {
      "command": "deck:go",
      "keys": [
        "PageDown"
      ],
      "args": {
        "direction": "forward"
      },
      "selector": ".jp-Deck"
    },
    {
      "command": "deck:go",
      "keys": [
        "PageDown"
      ],
      "args": {
        "direction": "back"
      },
      "selector": ".jp-Deck"
    }
  ]
}

Otherwise: it's difficult to anticipate everyone's needs, and thus far those needs have been mine and the few people who wanted this built. On my box when presenting (as I don't have another device), space is big and easy, pgup and friends are tiny and useless, so it never crossed my mind.

Theoretically, there could be another settings stanza that offered a number of pre-baked schemes, but any current work will be driven by just keeping up with the upstreams, a la #36.

nthiery commented 1 year ago

Thanks for the feedback! I confirm that shortcut configuration works. Up to one point, if I got it right: space (and similarly shift-space) is a compound key that actually runs two commands: down and forward. Is that achievable with shortcut configurations, or would it require to create a new command subsuming down+forward (which possibly could be best named forward, calling down+right, where right is the current forward?).

For information: I experimented with editing the sources, and adding the following compound keys in token.js line 195, and that worked smoothly (up to #49):

  [[DIRECTION.down, DIRECTION.forward], ['PageDown']],
  [[DIRECTION.up, DIRECTION.back], ['PageUp']],

Should you accept that as a reasonable default configuration, I can prepare a PR.