ffd8 / P5LIVE

p5.js collaborative live-coding vj environment!
https://p5live.org
GNU General Public License v3.0
226 stars 35 forks source link

Keyboard shortcuts in Windows and Linux #25

Closed JunShern closed 4 years ago

JunShern commented 4 years ago

Hi, me again!

I may be missing something very obvious, but I have been struggling to get a hang of keyboard shortcuts in P5LIVE.

In particular, I have been unable to get the following keyboard shortcuts (which I expect to be universal) to work:

I have tested these on my own local hosted P5LIVE setup and http://p5live.org, on both Chrome and Firefox, as well as in both Linux and Windows environments.

In all environments tested so far, the 3 commands above do nothing. But strangely, their close relatives are working fine for me:

ffd8 commented 4 years ago

Perhaps you're on Windows? Yeeeah.. I totally botched some basics on Windows.. CTRL + C, is used to show/hide the cursor when the editor is hidden... thus it breaks a really crucial default copy function... (Q: are you allowed to copy+paste while live coding?! jk). I also use CTRL + T for tidying the code.. but I think on Windows that opens a new Tab instead. I shooould use a VM for testing... I suppose the really nice thing to do, would be make the shortcuts editable and stored in the settings. Not sure how easy that would be to interpret in my keydown listener code. But I was also interested in letting Mac users switch to using 'CMD' though surely same issue, of ones that aren't allowed due to system/browser. I use CTRL + SHIFT + _ for adding snippets like audio and OSC... so I'd prefer to avoid that extra modifier.

Suggestions?

ffd8 commented 4 years ago

Wow, just found the mousetrap library = crazy cool. hotkeys.js is equally nice. I'll look into allowing shortcut customization, while leaving suggested defaults.

JunShern commented 4 years ago

Wow those are indeed really cool libraries!

Hmmm as a heavy shortcut user on Linux and Windows, I would much prefer having my favorite shortcuts built in by default, and I think it would make the first impression for new users much smoother as well.

How about having separate Edit and Command modes, where different sets of shortcuts live? This is a tried and true approach of some other editors, like Vim (try Vim) and Jupyter Notebooks (try Jupyter).

So for example:

Since there are two modes, you will have many more keybinding options available to you, and this way instead of using Ctrl+T to Tidy, you can change it so that users go in command mode and use T alone. This will be great so users don't have to change their usual shortcut habits.

The only downside I can think of from this is that it would break Vim compatibility in the Ace editor, which I had enabled previously because it was the only way I could get usable shortcuts... :laughing: But that's probably a feature P5LIVE live without; having good keybindings for general users is much more important!

ffd8 commented 4 years ago

Many thanks for working out tthese various ideas. Gotta say, the Edit vs Command Mode doesn't sound so user friendly, unless one comes from a VIM background – which I myself don't, nor any of my students who have usually never touched code, let alone CLI. That openvim link was great and I see the speed advantages when one is used to it, but I want to keep it more accessible. Not to mention on a Mac.. at least for now with this dumb touchbar.. my ESC key is super volatile 🤪😭.

However, you bring up a great point – I kind of see the edit/command mode as being when one toggles the editor as being visible or hidden, so there's no reason shortcuts like CTRL + C (toggle cursor when editor is hidden) should do anything while the editor is visible. Of course CTRL + T tidying code is something for only while the editor is visible (since it's locked when hidden).. so that just might need a personal remapping from the user on a windows machine. To be honest, it is Mac biased, as I'm developing on (and 99% of my students) are on mac laptops = no home/end keys to even know I'm missing that start/end of line shortcut. Soooo maybe a shortcuts pref panel, which lets one remap would be a decent compromise. The request for allowing VIM already came up – but is def a special case and would kill all the other keybindings = with such a pref pan... could potentially work around them.

ffd8 commented 4 years ago

Custom keyboard shortcuts are here! #37

geneticmoo commented 3 years ago

Please can you just change CTRL+C to CTRL+K or something (anything!) else. Also CTRL+A is a universal one. The user defined custom keyboard shortcuts is glitchy and very hard to use on Windows. I'd like to introduce this amazing environment to many people in workshops but this messy setting up business is putting me off.

Thanks

ffd8 commented 3 years ago

@geneticmoo – sure I'll look into changing these in the next release. Ran into this issue in the past two workshops, where indeed it breaks a few keys for PC/Linux users– though it was a quick fix by setting custom shortcut keys- shouldn't be necessary to do so (maybe need to analyse browser/OS and adjust metakeys). Did you try setting custom shortcuts within the settings panel? Curious what issues you run into when trying to manually set shortcut keys.. hopefully you can just click and create new ones, ie adding SHIFT.

geneticmoo commented 3 years ago

Yes - but the customs shortcuts is inconsistent and hard to use.

when you click on the Cursor Toggle line it goes green and then I'd expect pressing CTRL+K at the same time to change it. But it doesn't - you have to just press the C and then change it to K.

So then - on another line (CTRL+A is also reserved by Windows - select All) - assuming you only click on one thing at a time (ie CTRL or A) this time trying to change the CTRL to SHIFT does something different. It changes the whole line to SHIFT. And from then on I can't change this to anything else - so have to reset the whole of P5Live to start again.

So there is some inconsistency in how it works.


From: ffd8 @.> Sent: 31 March 2021 20:40 To: ffd8/P5LIVE @.> Cc: geneticmoo @.>; Mention @.> Subject: Re: [ffd8/P5LIVE] Keyboard shortcuts in Windows and Linux (#25)

@geneticmoohttps://github.com/geneticmoo – sure I'll look into changing these in the next release. Ran into this issue in the past two workshops, where indeed it breaks a few keys for PC/Linux users– though it was a quick fix by setting custom shortcut keys- shouldn't be necessary to do so (maybe need to analyse browser/OS and adjust metakeys). Did you try setting custom shortcuts within the settings panel? Curious what issues you run into when trying to manually set shortcut keys.. hopefully you can just click and create new ones, ie adding SHIFT.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ffd8/P5LIVE/issues/25#issuecomment-811387975, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABJEBI7T3WBWWFJAHJPMZDTTGN3DJANCNFSM4I6VBOXA.