-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Improvements to extra keys #1479
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
Conversation
48b05b4 to
58eb2a9
Compare
|
That's great ideas and implementations, although there are some design questions I have (I worked on ExtraKeys 2 years ago and I wanted to add part of what you did before). So you change the format allowed in the Here we specify that the "c" key must be displayed "C" on the keyboard and has the key "€" as a popup. In that case this : would be a shortcut for this : For your weechat example, I would write it like this : Here the key would be displayed as "weechat next" but send the "esc A" code to the keyboard. 1) Configurable popups
A more versatile way to do it would be to allow for an json object, we can add more information in future versions of the app : your implementation : my implementation : Another way would be to add a separate map (like you did for your macros) like this : but I wouldn't choose that because it wouldn't allow two keys to have the same text displayed but having two different actions, although that's not very restrictive. 2) Style and displayI've seen you added a new parameter that allows users to choose which Using my idea, we add an attribute called Here, the key is "c" but it's displayed "C". Here, the key is "RIGHT" but it's displayed "->". As stated before, using an external map is also possible : 3) MacrosYou now consider strings in I'm okay with that, I'm pretty sure no one wanted to have spaces in their key. Another way to do it without breaking previous configurations would be to use another keyword instead of "key" to emphasize it's a macro, like this : Here the key would be displayed as "weechat next" and execute the macro "esc A". We could also add a different keyword to specify it's not a macro but simple text : Here it writes "esc A" but displays the key as "ea". Here it writes "LEFT" but displays the key as "lt", the fact that we use the "text" attribute mean it's simple text, no control characters, however I don't think people would really use this. So, I'm okay with the fact that "esc A" is a macro. 4) Keyboard buttonVery good idea :) Conclusion
|
No, the strings in I like your other suggestions too. I don't remember why I made a separate config for macros, maybe to not change If |
|
is this already implemented? |
|
@trygveaa Yes, popup could be a string or an object containing the same information, it's a kind of a recursive data structure :) (but a popup cannot contain a another popup !), and we could also imagine multiple popups like on a real keyboard About macro, it's more safe to write it as { macro: "..." } even if a "macro string" doesn't look at all like a "single key" string or a "multi character" string like "if (". About "what if both macro and key are defined" I'd say raise an error, those arguments are mutually exclusive, currently the configuration can already raise an error (if the json is malformed). About display, It's verbatim, not going through CharDisplayMap, it makes no sense to say "the key LEFT must be displayed as RIGHT", the main idea for display is to provide your own Charmap anyway { key: "LEFT", display: "<-" } Shall I implement those ideas or will you ? :) |
|
@signotorez this is a pull request so the features described in the first post are implemented but the ideas of modifications I added aren't (yet). |
|
Also, BKSP and DEL do not autorepeat when long pressed like the arrow keys do. It clearly should be. Speaking of PGUP and PGDN it could be autorepeated too although I think it's less useful. |
|
love to see it at the next release, hope ;) |
Yeah, I thought about multiple popups too, but figured it could wait.
Sure.
👍
Alright, agree.
I can do it.
I guess all keys except for the modifier keys could repeat? |
Well, the standard keys on Android keyboard do not repeat, long press brings a popup. It's not very useful anyway to write "aaaaaaaaaaaaa" or "------" but hey, adding a { repeat: true } is still possible. But that's not a priority. |
I agree, I just thought that if I added repeat to all non-modifier keys, we wouldn't have to decide which are repeated and which are not repeated. Popups for these keys are triggered by swipe up, not by long press anyways, so repeat and popup works fine on the same key. |
|
I'd suggest we're updating this PR to [WIP] and opening a PR on your repo so that I can put some code too ? Or do I just send a message here saying "please pull from my branch" (doing pull requests the old way ^^). |
|
I've created a PR here :) |
This makes the keys you get when swiping up on a key configurable. You can configure such a key by using an array of strings instead of a single string in the row. The first entry will be the normal key and the second will be the extra key. This is a slightly breaking change, as people that have configured custom extra keys with "-" or "/" will have to change the config to keep the popup keys. The default config will remain the same in terms of functionality, i.e. it includes the same popup key for "-".
This stops the repeat action when the popup is shown, and makes sure the popup is closed when you release even if there has been some repeat actions.
This adds a setting for choosing between the different ways to render key names that were already present in ExtraKeysView. The available setting values are "arrows-only", "arrows-all", "all", "none" and "default". Other values will fallback to "default". Can be used as a workaround for termux#1410
This allows you to use the modifier keys on the extra keys rows, e.g. ctrl, together with another button on the extra keys rows, as long as that button is a normal letter and not a special key. Support for special keys will come in the next commit.
This allows you to use the modifier keys on the extra keys rows together with a special key on the extra keys rows, e.g. CTRL+LEFT. Fixes termux#745, fixes most of termux#895 and possibly termux#154
This adds a setting called extra-keys-map which allows you to map a key
on the extra keys rows to another action. The value is a json object
where the key is the button text as configured in extra-keys and the
value is the action. Multiple actions can be used, but if they are
special characters (like ESC or LEFT) they have to be separated from the
other characters with a space on each side. If you want an actual space
character, use SPACE.
For example if you want to add a key to go to the next active channel in
weechat, you can use this:
extra-keys-map = {"weechat next": "ESC a"}
And then add "weechat next" to extra-keys. The name can of course be
whatever you want.
Or if you want the button for the UP arrow to show ⇧ instead of ↑, you
can use this:
extra-keys-map = {"⇧": "UP"}
And put "⇧" in extra-keys instead of "UP".
Modifier keys (ctrl, alt and shift) can't be used in this map yet.
Support for ctrl and alt will come in the next commit.
I think this fixes termux#1186
This allows you to use CTRL and ALT in extra-keys-map.
For example if you want a button to exit the terminal, you can use this:
extra-keys-map = {"exit": "CTRL d"}
And add "exit" to extra-keys.
This toggles showing the keyboard input method.
2693987 to
d54546c
Compare
Like the arrow keys, the keys BKSP and DEL will now autorepeat well long pressed
Instead of specifying macros in the separate extra-keys-map option by matching the key name in the two options, you can now use "macro" instead of "key" in extra-keys, and it will be a macro, i.e. a sequence of multiple keys separated by space.
Now that you can specify macro in extra-keys, there is no point in having this separate option. Instead of specifying the value to display as key, and the macro to perform in extra-keys-map, you would now specify the value to display in the display property and the macro to perform in the macro property.
This will make it easier to support key aliases for macros in the next commit.
d54546c to
cee1d2c
Compare
|
The changes @robertvandeneynde and I discussed are now implemented. Here is a new description of what this PR implements:
To configure these things, each key in
The As an example, this is the config I use: |
|
The setting: { key: 'ESC', display: 'Esc' } still displays ESC in upper-case. |
* Make popup keys for extra keys row configurable This makes the keys you get when swiping up on a key configurable. You can configure such a key by using an array of strings instead of a single string in the row. The first entry will be the normal key and the second will be the extra key. This is a slightly breaking change, as people that have configured custom extra keys with "-" or "/" will have to change the config to keep the popup keys. The default config will remain the same in terms of functionality, i.e. it includes the same popup key for "-". * Make popup keys interact well with long press keys This stops the repeat action when the popup is shown, and makes sure the popup is closed when you release even if there has been some repeat actions. * Support configuring the style of the extra keys This adds a setting for choosing between the different ways to render key names that were already present in ExtraKeysView. The available setting values are "arrows-only", "arrows-all", "all", "none" and "default". Other values will fallback to "default". Can be used as a workaround for termux#1410 * Support using modifier keys with letter keys in extra keys This allows you to use the modifier keys on the extra keys rows, e.g. ctrl, together with another button on the extra keys rows, as long as that button is a normal letter and not a special key. Support for special keys will come in the next commit. * Support using modifier keys with special keys in extra keys This allows you to use the modifier keys on the extra keys rows together with a special key on the extra keys rows, e.g. CTRL+LEFT. Fixes termux#745, fixes most of termux#895 and possibly termux#154 * Support mapping extra keys to other actions This adds a setting called extra-keys-map which allows you to map a key on the extra keys rows to another action. The value is a json object where the key is the button text as configured in extra-keys and the value is the action. Multiple actions can be used, but if they are special characters (like ESC or LEFT) they have to be separated from the other characters with a space on each side. If you want an actual space character, use SPACE. For example if you want to add a key to go to the next active channel in weechat, you can use this: extra-keys-map = {"weechat next": "ESC a"} And then add "weechat next" to extra-keys. The name can of course be whatever you want. Or if you want the button for the UP arrow to show ⇧ instead of ↑, you can use this: extra-keys-map = {"⇧": "UP"} And put "⇧" in extra-keys instead of "UP". Modifier keys (ctrl, alt and shift) can't be used in this map yet. Support for ctrl and alt will come in the next commit. I think this fixes termux#1186 * Support CTRL and ALT in extra keys map This allows you to use CTRL and ALT in extra-keys-map. For example if you want a button to exit the terminal, you can use this: extra-keys-map = {"exit": "CTRL d"} And add "exit" to extra-keys. * Support a KEYBOARD button in extra keys This toggles showing the keyboard input method. * Support specifying macro keys in the extra-keys option Instead of specifying macros in the separate extra-keys-map option by matching the key name in the two options, you can now use "macro" instead of "key" in extra-keys, and it will be a macro, i.e. a sequence of multiple keys separated by space. * Remove option extra-keys-map Now that you can specify macro in extra-keys, there is no point in having this separate option. Instead of specifying the value to display as key, and the macro to perform in extra-keys-map, you would now specify the value to display in the display property and the macro to perform in the macro property. * Lookup display text when creating ExtraKeyButton This will make it easier to support key aliases for macros in the next commit. * Add support for a key to open the drawer Fixes (I think) termux#1325
* Make popup keys for extra keys row configurable This makes the keys you get when swiping up on a key configurable. You can configure such a key by using an array of strings instead of a single string in the row. The first entry will be the normal key and the second will be the extra key. This is a slightly breaking change, as people that have configured custom extra keys with "-" or "/" will have to change the config to keep the popup keys. The default config will remain the same in terms of functionality, i.e. it includes the same popup key for "-". * Make popup keys interact well with long press keys This stops the repeat action when the popup is shown, and makes sure the popup is closed when you release even if there has been some repeat actions. * Support configuring the style of the extra keys This adds a setting for choosing between the different ways to render key names that were already present in ExtraKeysView. The available setting values are "arrows-only", "arrows-all", "all", "none" and "default". Other values will fallback to "default". Can be used as a workaround for termux#1410 * Support using modifier keys with letter keys in extra keys This allows you to use the modifier keys on the extra keys rows, e.g. ctrl, together with another button on the extra keys rows, as long as that button is a normal letter and not a special key. Support for special keys will come in the next commit. * Support using modifier keys with special keys in extra keys This allows you to use the modifier keys on the extra keys rows together with a special key on the extra keys rows, e.g. CTRL+LEFT. Fixes termux#745, fixes most of termux#895 and possibly termux#154 * Support mapping extra keys to other actions This adds a setting called extra-keys-map which allows you to map a key on the extra keys rows to another action. The value is a json object where the key is the button text as configured in extra-keys and the value is the action. Multiple actions can be used, but if they are special characters (like ESC or LEFT) they have to be separated from the other characters with a space on each side. If you want an actual space character, use SPACE. For example if you want to add a key to go to the next active channel in weechat, you can use this: extra-keys-map = {"weechat next": "ESC a"} And then add "weechat next" to extra-keys. The name can of course be whatever you want. Or if you want the button for the UP arrow to show ⇧ instead of ↑, you can use this: extra-keys-map = {"⇧": "UP"} And put "⇧" in extra-keys instead of "UP". Modifier keys (ctrl, alt and shift) can't be used in this map yet. Support for ctrl and alt will come in the next commit. I think this fixes termux#1186 * Support CTRL and ALT in extra keys map This allows you to use CTRL and ALT in extra-keys-map. For example if you want a button to exit the terminal, you can use this: extra-keys-map = {"exit": "CTRL d"} And add "exit" to extra-keys. * Support a KEYBOARD button in extra keys This toggles showing the keyboard input method. * Support specifying macro keys in the extra-keys option Instead of specifying macros in the separate extra-keys-map option by matching the key name in the two options, you can now use "macro" instead of "key" in extra-keys, and it will be a macro, i.e. a sequence of multiple keys separated by space. * Remove option extra-keys-map Now that you can specify macro in extra-keys, there is no point in having this separate option. Instead of specifying the value to display as key, and the macro to perform in extra-keys-map, you would now specify the value to display in the display property and the macro to perform in the macro property. * Lookup display text when creating ExtraKeyButton This will make it easier to support key aliases for macros in the next commit. * Add support for a key to open the drawer Fixes (I think) termux#1325
This adds support for multiple things for the extra keys.
See the commit messages for more details.