mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-09-27 01:20:55 -04:00
binds/submap: fix submap enter bind == bind inside submap (#14856)
* Only process submap bindings if its the same on press
Move the check below the pattern match and check if the key was pressed
Address comment: Remove {}
Remove the new submap check and replace the old one
* tests/keybinds: add additional submap testcase
This tests for cases where the keybind to enter the submap is also bound inside it
---------
Co-authored-by: 0xdeadcode-arch <code.akshat.thukral@gmail.com>
This commit is contained in:
@@ -459,6 +459,14 @@ SUBTEST(submap) {
|
||||
press(KEY_P);
|
||||
EXPECT_CONTAINS(getFromSocket("/submap"), "default");
|
||||
|
||||
// submap 1 with identical keybind bound inside it
|
||||
press(KEY_U, MOD_META);
|
||||
EXPECT_CONTAINS(getFromSocket("/submap"), "submap1");
|
||||
press(KEY_U, MOD_META);
|
||||
EXPECT_CONTAINS(getFromSocket("/submap"), "submap3");
|
||||
press(KEY_O);
|
||||
Tests::waitUntilWindowsN(4);
|
||||
EXPECT_CONTAINS(getFromSocket("/submap"), "default");
|
||||
Tests::killAllWindows();
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ hl.bind(mainMod .. " + u", hl.dsp.submap("submap1"))
|
||||
|
||||
hl.define_submap("submap1", function()
|
||||
hl.bind("u", hl.dsp.submap("submap2"))
|
||||
hl.bind(mainMod .. " + u", hl.dsp.submap("submap3"))
|
||||
hl.bind("i", hl.dsp.submap("submap3"))
|
||||
hl.bind("o", hl.dsp.exec_cmd(terminal))
|
||||
hl.bind("p", hl.dsp.submap("reset"))
|
||||
|
||||
@@ -613,7 +613,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
||||
if (!k->locked && g_pSessionLockManager->isSessionLocked())
|
||||
continue;
|
||||
|
||||
if (!IGNORECONDITIONS && ((modmask != k->modmask && !k->ignoreMods) || (k->submap.name != Config::Actions::state()->m_currentSubmap && !k->submapUniversal) || k->shadowed))
|
||||
if (!IGNORECONDITIONS && ((modmask != k->modmask && !k->ignoreMods) || ((k->submap.name != key.submapAtPress.name) && !k->submapUniversal) || k->shadowed))
|
||||
continue;
|
||||
|
||||
if (device) {
|
||||
|
||||
Reference in New Issue
Block a user