• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category User Interface
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.4
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Blue_Dude - 2010-03-06
Last edited by Blue_Dude - 2010-04-01

FS#11081 - Adds user programmable hotkey to context menus

This is a work in progress. This first patch shows how the interface would work on the e200 target only. The hotkey selected for the e200 is short-REC, which was the key used in the bookmark menu to specify the delete function. So far, the hotkey doesn’t do anything except show a splash message, except in the bookmark menu, which works as before.

The goal is to allow the user to drill down to the context menu with the context menu button, scroll to the function intended for the hotkey, then press the context menu button again to assign that function to the hotkey. Then, the user could press the hotkey button on an item rather than the context menu button to perform that function. The hotkey assignment would persist between session, and would vary by context menu.

Comments are appreciated.

Closed by  Blue_Dude
2010-04-01 03:21
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Committed as r25414

I think we’ve rejected this kind of work before (see  FS#5555 ) but maybe opinions have changed since then.

Hm. I read some of the comments on  FS#5555 . I sure would like to know why it was ultimately rejected.

Here’s a working version with keymapping for the e200. So far the only hotkey functions that can be assigned are delete file/dir and playlist insert. It’s easily expandable though.

This one is ready for general use. I’ve included LANG strings and a way to disable the hotkey: just try to assign the hotkey to a function that’s not supported.

Adds WPS hotkey function, co-opting the current playlist view hotkey. The WPS hotkey defaults to playlist view, so unless the user changes it, operation is completely transparent. Some code cleanup to make it easier to read and change.

This is another code cleanup, with better build optimizations and a smaller binsize. Non-hotkey targets have no binsize increase at all and even hotkey targets can be built by commenting out the HOTKEY define in its config file without any binsize increase.

I forgot to mention that a couple of versions back I made the hotkey assignment key the same as the hotkey itself. So to assign a hotkey, go into the tree or WPS context menu, scroll to the function you want to assign and press the hotkey. If it’s an acceptable assignment, the splash will confirm the new assignment. If not, the splash will say that the hotkey is Off and the assignment will be cleared. Assignments are permanently saved.

Rewrote the set and execute hotkey functions to much more easily incorporate additional function assignments. Assignments are now in a simple struct that has all the info needed to assign and run hotkeys. Bin size is about the same as before, but adding more functions in the future will take much less room going forward than adding in all that else-if and case code. For instance, I enabled the existing delete function in the WPS screen and it didn’t add any size at all since it was a matter of setting a flag. Each new function adds 20 bytes.

there shold be a way to see the hotkeys value (or action or whatever) and a proper way to clear it instead of trying to assign to an illegal value.
Also, I dont tihnk the assignemnt should persist over boots.

Added a menu under Settings→General Settings→System→Hotkey that has the following items: Hotkey Persistence, View Hotkey Settings, and Reset Settings. Persistence is boolean, with yes meaning keep settings between sessions. If no, then settings are reset to default during init. View Hotkey Settings shows the functions associated with those keys and Reset Settings resets to defaults. Note that if the default is anything other than OFF, there’s no way to completely disable that hotkey. However, this mimics current hard coded key behavior.

These additions cost quite a bit of bin size though: about 600 bytes.

Got rid of the persistence menu item. With a method of resetting the hotkeys manually, it’s not necessary. Hotkey settings are now always persistent. If you’ve got to have it, though, I’ve included a patch that puts it back in.

Added a confirmation dialog for setting hotkeys, so they should never be set by accident. Moved the hotkey menu from the system menu to the general settings menu, which isn’t quite so deep and makes more sense.

Code cleanup, minor changes. Ready to go!

Key assignments for the tree screen and WPS screen can be different. This should make creating keymaps far easier. Many fewer conditional compile statements, which is much cleaner but causes a bit of code bloat (< 100 bytes). Keymaps are included for e200 and c200, but hotkeys are disabled by default. Uncomment the define in the config files to switch them on. Took out code in bookmark.c - remapping the delete key to the hotkey just isn’t going to work for some targets. Maybe it’ll be included later.

OK, got a lot of work done on different keymaps. There are quite a few targets that can be switched on for hotkeys without any more keymapping. But there are also many that need work. All the targets that can support hotkeys out of the box are switched on. The others have placeholder lines that show where work is needed, and are switched off. Some look like they won’t ever support hotkeys.

To assign hotkeys, I used the existing keypress in WPS for View Playlist, which the hotkey replaces. If that keypress could be assigned to the tree hotkey without conflict, I copied it. If not, I put in a commented out placeholder for future assignment. If both the WPS and tree hotkeys were valid, I switched on the hotkey in the associated config file. If not, I put in the lines but commented out the define.

There are several targets that can support hotkeys but there was some kind of conflict that prevented me from making a valid assignment. Changing existing key assignments to clear the conflict should be a group effort. And there were several targets that didn’t support View Playlist and I didn’t try to go further without more target specific information. Those keymaps were unchanged and their configs switched off.

Maybe simply remove ACTION_WPS_VIEW_PLAYLIST and move the #ifdef’d part into the ACTION_TREE_HOTKEY case (removing the need to #ifdef around in the keymap files?

I kept the ifdef’s in there in case you might want to switch off the hotkey for any reason and get current behavior back. Right now while it’s still being rolled out that’s prudent. I intend to remove the ifdefs for fully supported targets later. I can’t assign both TREE and WPS in the same place because they’re in different contexts, so they will always be separate definitions. And if TREE isn’t currently defined that means there’s a keymap conflict that needs to be resolved by someone with good target knowledge. Once both TREE and WPS are defined without conflict, you can switch on HOTKEY in the config and remove the ifdefs in the keymap without any issue.

I’m not sure if you understood me correctly.

My idea was to ACTION_WPS_VIEW_PLAYLIST (and the case in wps.c) and to put the code of the ACTION_WPS_VIEW_PLAYLIST case into the ACTION_TREE_HOTKEY case. Basically let ACTION_TREE_HOTKEY replace ACTION_WPS_VIEW_PLAYLIST no matter of HAVE_HOTKEY being defined or not.

Removed conditional compile in wps.c. This makes assigning the keypress for WPS hotkey more flexible in some targets. Also added Show Track Info and Open With… to potential assignments. Tweaked the function code for delete to take into account that not all selections are valid for deletion (replaces menu callback logic).

Cleaned up, changed defines.

Bug in features.txt. Use this instead.


Available keyboard shortcuts


Task Details

Task Editing