Repository navigation
Conversation
slopesque
marked this pull request as ready for review
August 26, 2026 16:44
slopesque
marked this pull request as draft
August 26, 2026 16:44
slopesque
marked this pull request as ready for review
August 28, 2026 17:26
vaxerski
reviewed
Aug 30, 2026
| const int optsIdx = fnIdx + 1; | ||
| Keybinds::SSubmapArgs args; | ||
|
|
||
| if (lua_gettop(L) >= optsIdx) { |
Member
There was a problem hiding this comment.
since we are reusing this (Also for binds) it would make sense to unify those parsers to produce some shared CDeviceList from lua (CDeviceList::fromLua() or sumn)
| uint32_t m_lastMouseCode = 0; // last mouse button code, 0 if last was keyboard | ||
| uint32_t m_timeLastMs = 0; // timestamp of last key/mouse event | ||
| std::string m_currentSubmap = ""; // current keybind submap name | ||
| SP<IHID> m_lastDevice; // device used to press last keycode |
| }; | ||
|
|
||
| // testing with actual devices requires being able to instantiate them | ||
| // virtually :( |
Member
There was a problem hiding this comment.
and you can, check the plugin in hyprtester. You can test it with integration tests
slopesque
force-pushed
the
feat/per-device-submaps
branch
4 times, most recently
from
September 1, 2026 23:58
1c5ad97 to
4c31a90
Compare
… submap to devices
…ce is valid too action state now keeps track of the device used for the most recent input
CSubmap::matchesDevice process is now handled as a case of CDeviceList::contains
slopesque
force-pushed
the
feat/per-device-submaps
branch
from
October 1, 2026 07:54
ed27c07 to
349e0a6
Compare
* CSubmapContext interface has been pruned to only follow actual use cases by other components * CSubmapContext::find now search by submap name and device * added custom uniset submap action. it resets the context and only add the specified submap to the context * updated multiSubmap to match new behavior on dedicated test submaps
slopesque
force-pushed
the
feat/per-device-submaps
branch
from
October 20, 2026 14:48
349e0a6 to
a771309
Compare
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.
Closes #15640
Describe your PR, what does it fix/add?
An implementation for per-device submap definitions. This PR thus proposes :
hl.define_submapto accept metadata similar to what we do withhl.bind. So far, only thedevicekey is handled.Keybinds::CBinds inKeybinds::CRegister.Just like bindings, if the submap has no device mapped to it, it becomes global. Otherwise, the submap will be set if and only if the last device used to press a key (in practice, the one that has the key pressed to trigger
hl.dsp.submap()) is mapped by the submap.Below is an example code snippet that can be added to an Hyprland test configuration to test the feature :
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
Keybinds::CSubsetData StructureRight now (and if I understand correctly), we handle binds directly using two strings in
Keybinds::SBindMetadata:submapandsubmapReset. When we want to check the submaps, we look for them inCBindobjects directly (ex:Keybinds::CRegistry::hasSubmap).As we now allow metadata values for submaps which can be lead to evolve along with Hyprland's features, such an approach may not scale well on the long run. In order to handle device mappings, the PR thus introduces a dedicated data structure
Keybinds::CSubsetfor submaps. The idea is to store them along withKeybinds::CBinds in the keybinds registry, where they are also reset when the keybinds are reset.m_lastDeviceinConfig::Actions::CActionStateChanges I saved as commit
ddb4f88cbce700360f79f2bd2f1bf4dc49465604gathers everything related to my current approach to pass on the current input device to the submap match search inConfig::Actions::setSubmap: so far, I added aSP<IHID> m_lastDevicefield to the global config action state, which I read duringsetSubmap.I think there might be way, way better ways to do this other than straight up tracking the last device in the global action state. That being siad, I'm still very new to the codebase and this is the first option I have found. I kept this commit to at least have a functional first result, but please do tell if they are more efficient ways to pass around the input device across
Keybindscallbacks.AI Usage
As it is my first time working in Hyprland, I only relied on an AI model (Claude Sonnet in this case) for analysis purposes, in order to grasp an initial understanding of Hyprland's global structure and the project filesystem. Beyond that, I no longer used AI and favored understanding Hyprland's modules by reading the source code, testing its behavior using a debugger and checking out the documentation for the Lua C API. Moreover, I haven't used any AI while working on the feature itself.
Is it ready for merging, or does it need work?
The API and backend logic is ready and tested. The only missing part from the original feature request is to remove the global lock on submaps to allow multiple ones being active at the same time. Whether we implement it here or in a second PR is up to discussion.
The architecture change regarding
CSubmapshould also be approved before merging. If there is no problem with it, then we can change the existing logic to align it with the new API.