New feature to distinguish whether the Windows, Control, Alt, and Shift keys are the left or right keys#1985
Open
jilliss wants to merge 2 commits intoSmithay:masterfrom
Open
New feature to distinguish whether the Windows, Control, Alt, and Shift keys are the left or right keys#1985jilliss wants to merge 2 commits intoSmithay:masterfrom
Windows, Control, Alt, and Shift keys are the left or right keys#1985jilliss wants to merge 2 commits intoSmithay:masterfrom
Conversation
…nd `Shift` keys are the left or right keys For use by downstream NIRI
Author
|
@PolyMeilex @YaLTeR could you review this? |
PolyMeilex
reviewed
Apr 6, 2026
Member
PolyMeilex
left a comment
There was a problem hiding this comment.
Hi!
Could you explain when and how are those new fields cleared? At a first glance at the diff I only see them being set to true
| /// This method checks if standard modifier names (e.g., Ctrl, Alt, Shift, Caps Lock) | ||
| /// are currently active in the "effective" state and updates the corresponding | ||
| /// boolean fields of the struct. | ||
| pub fn init_key_val(&mut self, state: &xkb::State) { |
Member
There was a problem hiding this comment.
Any reasons for this being part of the public API?
Going of the vibe it seems to be an internal helper function.
Author
There was a problem hiding this comment.
Optimized the assignment logic as suggested. Thanks!
Comment on lines
102
to
119
| // 1. Initialize modifier values based on current state | ||
| self.init_key_val(state); | ||
| // 2. Identify the specific physical key pressed | ||
| let keysym = state.key_get_one_sym(keycode); | ||
| // 3. Match specific modifier keys and update their respective flags | ||
| match keysym.into() { | ||
| xkb::keysyms::KEY_Super_L => self.logo_left = true, | ||
| xkb::keysyms::KEY_Super_R => self.logo_right = true, | ||
| xkb::keysyms::KEY_Control_L => self.ctrl_left = true, | ||
| xkb::keysyms::KEY_Control_R => self.ctrl_right = true, | ||
| xkb::keysyms::KEY_Alt_L => self.alt_left = true, | ||
| xkb::keysyms::KEY_Alt_R => self.alt_right = true, | ||
| xkb::keysyms::KEY_Shift_L => self.shift_left = true, | ||
| xkb::keysyms::KEY_Shift_R => self.shift_right = true, | ||
| _ => {} // Ignore non-modifier keys | ||
| } | ||
| // 4. Synchronize the serialized string representation of active modifiers | ||
| self.serialized = serialize_modifiers(state); |
Member
There was a problem hiding this comment.
Let's drop the meaningless LLM-style comments, and keep only the // Ignore non-modifier keys one
Author
|
Could you please review my code again? @PolyMeilex @Drakulix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For use by downstream NIRI
Description
I noticed that niri was developed based on this project.
Furthermore, niri has an outstanding issue: it does not support advanced keyboard modifiers
such as Super_L. This commit adds support for them.
Specifically, it adds a
keycodeparameter to keyboard input to identify the specific keyand introduces some boolean values to track key presses for use by downstream components.
see niri issues Do not support Shift_R key.
Checklist