Add shortcuts to the command bar (priority to function key shortcuts) #529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Configurable Display of Keyboard Shortcuts on Command Bar Buttons
WARNING: written by AI, but under strict guidance to do the minimal best-practice changes with respect for the existing code, verify heavily, etc., and briefly reviewed by myself.
Overview
This PR adds a new feature to the Sunflower file manager that allows users to display keyboard shortcuts on the command bar buttons, similar to how the action buttons are displayed at the bottom of Norton Commander and Midnight Commander.
Fixes: #120
Screenshot
What does this change do?
Why is this useful?
This improves user safety by allowing users to easily verify which keyboard shortcut corresponds to each button, reducing the chance of accidental operations. Personally, even though some of the shortcuts are in muscle memory, I always want to look at the command bar and verify the short cut before starting a bunch of operations, as the Copy/Delete/Move function keys can be "a little close" at the best of times ;) This is especially true when adopting a new file manager for the first time. #120 suggests that other users feel the same way.
Files Changed
sunflower/gui/main_window.py_command_bar_buttonslist to track button references with accelerator mappings_update_command_bar_labels()method to update button labels with function key prioritizationshow_command_bar_shortcutsconfig option (default: False)apply_settings()sunflower/gui/preferences/display.pyDefault Behaviour
The feature is disabled by default to preserve existing behaviour.
NOTE: I'll be submitting a separate, second PR on top of this to enable by default, so that can be easily rejected independently, if necessary.