Skip to content

Separate modifier for RAlt #756

@chrisduerr

Description

@chrisduerr

I've been trying to troubleshoot this Alacritty issue and have noticed that when RAlt (or commonly also AltGr) is pressed, that the alt modifier is set as active in the winit events.

In the context of a terminal emulator this is problematic though, since the "normal" Alt key is used to send special escape sequences. As far as I know, the RAlt or AltGr key is mainly used for unlocking additional characters on conventional keyboards, so it's often already handled by the ReceivedCharacter event.

As a solution to this issue, it would be nice if the ModifiersState could differentiate between the normal and the right alt key. This would make it straight-forward to know if the key can be ignored since it's handled by ReceivedCharacter, or if additional escapes need to be sent.

Now it should be mentioned that it would be possible to work around this by tracking the LAlt key and stetting/unsetting the key as hold whenever it's presessed/released. However since the modifiers struct seems to be made to get information about the current modifiers and others might run into similar issues, it might be worth expanding it? Though I can see how keeping the modifiers simple would also be an advantage, so maybe this should be treated as a special case that needs to be handled in Alacritty.

Regarding the actual implementation, this would be a breaking change if the alt modifier is not sent anymore and altgr or lalt would be sent instead. It would also be breaking if a separate enum/struct for the alt modifier would be introduced. One approach for adding this in a backwards-compatible way would be to add the altgr or lalt modifier, but always sending alt too, if it is pressed. If this is a desired feature I'd love to help out myself, though the approach should be determined first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C - needs investigationIssue must be confirmed and researchedDS - appkitAffects the AppKit/macOS backendS - apiDesign and usability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions