sonic-pi icon indicating copy to clipboard operation
sonic-pi copied to clipboard

Refactor shortcut related code & add shortcut tab to settings

Open SunderB opened this issue 6 months ago • 1 comments

Hi, it's been a while! I've seen that some work has been done on shortcut configuration, and had some motivation to have a look at it a bit. Hopefully these changes manage to improve/simplify shortcut handling:

Features/bug fixes

  • Move most code related to shortcuts to its own class
    • All default shortcuts are defined using a more standard string format, which can be passed straight into QKeySequence
    • Default and user-defined shortcuts are kept in separate lists, with the user-defined bindings taking priority (only matters if shortcut mode = user)
  • Add new Shortcuts tab to the settings widget
    • Combo box to select the shortcut mode (emacs, windows, mac, user)
    • Shows list of current shortcuts/key bindings
  • When shortcut mode is set to user, create a new config file when exiting if it doesn't exists
  • Tweak some key bindings for consistency and to avoid clashes

WIP: Need to add some text to the shortcut settings tab, test the user shortcut mode, and do a once over of the code.

Screenshots

The current UI is shown below: Screenshot_20250504_100831

Testing

I'm only able to test this on Debian (Trixie) - it'll probably want testing on Windows/Mac as well. ~~I'm unsure whether the code I've written is Qt5 compatible, but I assume Qt6 is becoming the main option anyways.~~ I just saw the commit deprecating Qt5, so I'm going to assume using Qt6 features is fine. Feedback & suggestions are welcome :)

SunderB avatar May 04 '25 10:05 SunderB

Interesting. I definitely think there's scope for some nicer UI for working with shortcuts. I wonder what the gold standard is here? One thing that I'm curious about with your design is how it handles really long lists of shortcuts - will that be scrollable content within the prefs?

samaaron avatar Jun 09 '25 12:06 samaaron