Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keybind customization #431

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mitchcapper
Copy link

@mitchcapper mitchcapper commented Apr 27, 2022

Initial keybind customization work, note this is only configurable in the settings json but you can do things like:

"KeyBindOverrides": {
  	"NewCSXScript": "Control+U",
  	"NewCSDocument": "Control+Shift+U"

  }

See the enum for all key binds.
Note: While I replaced all the UI Keybind calls in the two main docs for windows this is largely a POC commit. I also show two examples of how this could be done. One is where the view directly accesses a model data type, it is a bit cleaner IMOP but not exactly binding to the VM:

  • ToolTip="{Binding Converter={StaticResource KeyBindToDescriptionConverter}, ConverterParameter={x:Static ui:KEY_BIND.RunScript}}"
  • The other example is more MVVM and what i did for most but requires adding another field for each key bind to the viewmodel:
    Key="{Binding SaveGesture, Mode=OneTime, Converter={StaticResource KeySequenceToGestureConverter}}" (with SaveGesture added to the VM)

You will also note some stupidity where I have to bind both Key and Modifiers separately, this is unavoidable I believe (as Gesture is not a dependency property).

Assuming you want this let me know which style you prefer ill update all the ones I can find in the code and update the PR.

Note: AvalonEdit does not support key bind changes easily either. We can add binds but not really remove (I believe). I can make a PR on it though to add that support if we want to proceed to allow rebinding those too.

Closes #272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hotkey Customization
1 participant