-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added permanent key mappings #47
Conversation
01c203b
to
e02789f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Draft review) LGTM. The remap functionality works flawlessly. And I must say that permanent remapping is definitely a useful option to have.
I would like to see a better explanation of what remap
does in the configuration file (as it is with the other table headers ([...]
)).
- permanent remapping without the need to hold a hyper key
- ability to swap two keys as follows:
[Remap]
KEY_T=KEY_M
KEY_M=KEY_T
I think that for clarity, it is important to have the remap
table before the hyper key and hyper key bindings tables in the config file to emphasize the independency of permanent mappings to the hyper key.
Furthermore, I think that it is worth mentioning in the config file that if you want to define a specific behaviour to a permanently remapped key (KEY_T
) with a hyper key, you will get a behaviour of a remapped key (KEY_M
) when pressing the original key (t
): When pressing hyper key + t
, you get e
. I am not sure if this is desirable or whether it would be better to allow explicitly defining a different hyper key behaviour for KEY_T
: To get r
when pressing hyper key + t
and to get e
when pressing hyper key + m
.
[Bindings]
KEY_T=KEY_R
KEY_M=KEY_E
# Permanent remappings
[Remap]
KEY_T=KEY_M
In the same manner, I feel like there should be an option to use a permanently remapped key (t
in this case) as a hyper key. As of now, that is not possible.
As of now, I would approve the PR to be merged if we do not want to act on the points above. If additional functionality is planned to be added to the PR, I will reevaluate the review.
What would you like to see as a comment?
I am wondering if this is just confirmation since that's how the config file is.
It seems like you're conceptualizing this in a different way than I did. You're expecting that 't' is always recognized as 't' for input, regardless of the configuration. Is it more intuitive to always refer to a key as the physical keyboard key, regardless of remapping? I thought of remapping as if it were an external application. If you remap 't' to 'm', you shouldn't expect 't' as input anymore. If you remap 't' to 'm', but then want to map 't' to 'y' when space is held, you would remap 'm' to 'y' for the layer. I wrote this with the remap layer being the first layer, and I believe you're imagining it as the last layer. How do other key mapping projects (xkb, xmodmap) handle remapped keys. Do later configuration lines still detect the key as 't'? I'm open to reworking this, although the proposed logic is a bit more difficult to implement. The logic change should allow you to use a remapped key as the hyper key but you would refer to it as the physical key in the hyper configuration. Proposed example:
|
"Permanent" remapping sounds like it modifies something so the key is forever remapped even if touchcursor is removed.
Xmodmap only binds symbols to keycodes. For The proposed example seems the most logical, it produces exactly what you see in the file. |
After some cursory research, I noticed this too. I will move forward with the proposed changes, i.e. moving the remap layer to the last layer.
Any suggestions for different wording? |
Drop the word "permanent" and only call it key or keycode remapping. |
Just a confirmation, yes.
I would rather keep the # Permanent remappings.
# Allows to set permanent remappings when running the service without a need to hold a hyper key.
# Each remapping will be active permanently when the service is running.
# The permamently remapped key can be remapped differently while holding the hyper key in table `[Bindings]` with the original key name:
# [Remap]
# KEY_T=KEY_M
# [Bindings]
# KEY_T=KEY_D
#
# You can swap the functionality of two keys as follows:
# [Remap]
# KEY_T=KEY_M
# KEY_M=KEY_T
[Remap] If we want to further discuss the exact wording, I can create a PR to be merged onto this branch when we are in an agreement. Actually, looking at the config file now, We have two separate tables allowing setting some remappings ( # Hyper key bindings.
# The following bindings remaps keys only when holding a hyper key.
# The remapping has the format:
# KEY_1=KEY_2
#
# For usable key names, see 'github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h'.
#
# For example, when holding the hyper key, key 't' will output key 'k':
# [Bindings]
# KEY_T=KEY_K
[Bindings]
Both approaches are possible. I think, however, that having the permanent remappings as the last layer would be more beneficial to the user when the original keys are to be remapped with the hyper key functionality as well. I agree with the chosen approach. Exactly as @donniebreve described, I prefer the following approach much more for the ease of use for the user:
|
Those three comments read exactly the same if "permanent" is removed.
|
Maybe, but if you want to refer to the feature anywhere else without all these exhaustive comments, you have to have a single self-explanatory name for the feature. Without the Furthermore, due to backward compatibility, we cannot rename the hyper key bindings under the table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me now. The mapping behaves exactly how I would have intuitively understood it to, and every discussed combination of permanent remappings and hyper key remappings works. Even permanent remapping of a key and using the same key as a hyper key.
I would consider this PR to be in a ready-to-merge stage. Up to you to decide whether to undraft the PR and move towards merging. Great job.
@donniebreve What do you think about this PR? I have been using the permanent remapping since opening this PR and I think it works great. I cannot say that I found any problems with it. As you mentioned somewhere, it might be a good idea to review the whole of As far as this PR goes, I think it is a great addition to the application and is ready to be merged, except for maybe addressing the debug prints. |
Sure, let's merge this in until I get some motivation to rewrite some things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It is a great feature to have (I cannot express enough how much this PR helped me – having enter key in a place of semicolon, so thanks). As agreed upon, I agree that we can merge this PR. Additional changes may come later. Feel free to merge the PR at your leisure.
Added functionality for permanent key remapping. See #15.