cynicaloptimist / improved-initiative

Combat tracker for Dungeons and Dragons (D&D) 5th Edition
https://www.patreon.com/improvedinitiative
MIT License
314 stars 109 forks source link

Explore new default keyboard bindings #452

Open chrisbloom7 opened 4 years ago

chrisbloom7 commented 4 years ago

While discussing solutions to https://github.com/cynicaloptimist/improved-initiative/issues/416 we hit upon the idea of trying to remap the default keyboard bindings so that they don't require modifier keys which can be problematic for a couple of reasons.

chrisbloom7 [...] Differences in keyboard configurations between operating systems make it hard to communicate hotkeys to users without UI work to toggle between them based on system detection. Combo hotkeys can present accessibility problems for users with coordination and stability issues. And of course there is always the risk they will interfere with native hotkeys. I appreciate that you allow for custom hotkey bindings. Perhaps we could take this a step further and allow hotkeys to be disabled entirely in the settings?

cynicaloptimist I like your last suggestion- a check box to just disable all hotkeys would simplify this issue for some users. Hotkeys may be problematic (fair enough), but they are very core to the original vision of Improved Initiative as a 'one-handed' combat tracker. However, I'm not collecting metrics on how often the hotkeys are actually being used so I could be way off.

chrisbloom7 Yeah, I can understand that. It is really hand[y] to quickly move around with the keyboard instead of relying on the mouse and finding the correct icon. I make use of the j, k keys a lot in encounters. One additional thought: perhaps instead of relying on modifiers like ALT, CTRL, etc, which usually have special functions, the defaults could be strictly singe keys, shift+single key, or combinations of single keys/shift+single keys for related functions (i.e. t m to toggle the menu and t l to toggle the libraries).

Goals:

Possible stretch goal: add some metrics collection for keybindings?

Here are the current defaults for reference:

Screen Shot 2019-11-20 at 9 49 10 PM Screen Shot 2019-11-20 at 9 49 04 PM
chrisbloom7 commented 4 years ago

@cynicaloptimist As discussed in #416, I'll take a stab at some alternate key mappings and make some proposals here.

chrisbloom7 commented 4 years ago

OK, this was kinda fun. Here's a verbose version that uses keywords instead of just hotkey combinations. This works out of the box with the current hotkey library. I tested it out and it works well. Miskeys are ignored and you just start again. I'd want to add an esc hotkey the close the library since that could be made to work while focus is in the text box. I'll play around with some other configurations that are less verbose.

COMMAND SECTION HOTKEY
Settings Encounter Commands ?
Hide/Reveal AC in Player View Combatant Commands a c
Quick Add Combatant Encounter Commands a d d
Previous Turn Encounter Commands b a c k
Restore All PC HP Encounter Commands b l e s s
Clean Encounter Encounter Commands c l e a n
Clear Encounter Encounter Commands c l e a r
Move Down Combatant Commands d o w n
End Encounter Encounter Commands e n d
Toggle Full Screen Encounter Commands f u l l
Apply Healing Combatant Commands h e a l
Apply Damage Combatant Commands h i t
Edit Initiative Combatant Commands i n i t
Open Library Encounter Commands l i b
Link Initiative Combatant Commands l i n k
Select Next Combatant Commands n e x t
Update Persistent Notes Combatant Commands n o t e
Hide/Reveal Combatant in Player View Combatant Commands p c
Select Previous Combatant Commands p r e v
Remove from Encounter Combatant Commands r e m
Rename Combatant Commands r e n
Roll Dice Encounter Commands d i e
Reroll Initiative Encounter Commands r o l l
Save Encounter Encounter Commands s a v e
Start Encounter Encounter Commands s t a r t
Edit Unique Statblock Combatant Commands s t a t
Add Tag Combatant Commands t a g
Apply Temporary HP Combatant Commands t e m p
Next Turn Encounter Commands t u r n
Move Up Combatant Commands u p
Launch Player View Encounter Commands v i e w
Toggle Wide Menu Encounter Commands m e n u
Close Library Encounter Commands esc TODO
cynicaloptimist commented 4 years ago

The multi-hotkey spellings are pretty amusing, but I think they're impractical (especially for one-handed use). Single-key hotkeys are an important part of the II interface. I think I'd approach this from the principle that "common" commands should use a single key, and "uncommon" or hard-to-undo ones could use two. What do you think about this set?

Command Hotkey Mnemonic
Toggle Wide Menu o m open menu
Open/Close Library o l open library
Launch Player View o p open playerview
Toggle Full Screen f11 [native hotkey]
Settings ? [help]
Start Encounter e g encounter go
Reroll Initiative e i encounter initiative
End Encounter e x encounter x[stop]
Clear Encounter e d encounter delete
Clean Encounter e c encounter clean
Quick Add Combatant e a encounter add
Restore all Player Character HP e l encounter hea(l)
Save Encounter e s encounter save
Roll Dice d dice
Next Turn n next
Previous Turn b [beside n]
Apply Damage t take
Apply Healing l hea(l)
Apply Temporary HP shift+l hea(l)
Add Tag g ta(g)
Update Persistent Notes y
Remove from Encounter x x
Hide/Reveal in Player View h hide
Reveal/Hide AC in Player View shift+h hide
Rename s n set name
Edit Unique Statblock s s set statblock
Edit Initiative s i set initiative
Link Initiative shift+i shift+initiative
Move Down shift+j
Move Up shift+k
Select Next j
Select Previous k
chrisbloom7 commented 4 years ago

I think I'd approach this from the principle that "common" commands should use a single key, and "uncommon" or hard-to-undo ones could use two.

I whole heartedly agree with this and that was the approach I was taking with the few sets I was working on. (Edit: Though I was finding I had a very limited data set of 1 on what the common keys are.) I have a couple sets I was still working around, one being a minimalist set with one-key commands for everything (branching into some of the non alpha keys), and another I was trying to base around the old WASD-style keyboard key layouts of older games, but neither were complete yet. I think your set works great and the mnemonic hints make them memorable. I have a few suggestions in mind, but I might not be able to write them up until sometime this weekend. I'll post my suggestions asap.

cynicaloptimist commented 4 years ago

I'm on the fence on whether we should ensure there's some sort of "revert to old defaults" option before introducing the set of new defaults. Any thoughts?

chrisbloom7 commented 4 years ago

I like the idea of a "Revert to defaults" in general to go back to what the current defaults are, but if there's a lot of overhead to go back to the "old" defaults, and you don't want to go down the road of having multiple profiles, then perhaps just posting a link to a list of the old defaults for the next couple minor releases would be an easy middle ground

chrisbloom7 commented 4 years ago

I got side tracked and haven't finished my own list of keybinding suggestions. Should I continue to work on them if I can get them posted soon (like within the next couple days) or are you moving ahead with the keybindings you came up with?

cynicaloptimist commented 4 years ago

I like my keybindings but I'm not married to them. I'm not planning to do any work related to this issue in the immediate future; I'm currently working on porting the main Combatants by Initiative display over to a React Component, and making the inline commands configurable. I'd take a look at your next set of suggestions if you'd like to share them- then we could probably shake out a final "new default" by combining the best ideas that we've come up with.