From 24a95621e5118e39e1a6e05b17ef89f4ec2c8c01 Mon Sep 17 00:00:00 2001 From: ArchSav <96357545+ArchSav@users.noreply.github.com> Date: Sat, 14 Mar 2026 00:48:01 +1100 Subject: input: add device specific binds (#13073) Adds support for device-specific binds --- hyprtester/src/tests/main/keybinds.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'hyprtester/src/tests/main/keybinds.cpp') diff --git a/hyprtester/src/tests/main/keybinds.cpp b/hyprtester/src/tests/main/keybinds.cpp index a87a8b07..e01edd36 100644 --- a/hyprtester/src/tests/main/keybinds.cpp +++ b/hyprtester/src/tests/main/keybinds.cpp @@ -513,6 +513,34 @@ static void testSubmapUniversal() { EXPECT(getFromSocket("/keyword unbind SUPER,Y"), "ok"); } +static void testPerDeviceKeybind() { + NLog::log("{}Testing per-device binds", Colors::GREEN); + + // Inclusive + EXPECT(checkFlag(), false); + EXPECT(getFromSocket("/keyword bindk SUPER,Y,test-keyboard-1,exec,touch " + flagFile), "ok"); + OK(getFromSocket("/dispatch plugin:test:keybind 1,7,29")); + EXPECT(attemptCheckFlag(20, 50), true); + OK(getFromSocket("/dispatch plugin:test:keybind 0,0,29")); + EXPECT(getFromSocket("/keyword unbind SUPER,Y"), "ok"); + + // Exclusive + EXPECT(checkFlag(), false); + EXPECT(getFromSocket("/keyword bindk SUPER,Y,!test-keyboard-1,exec,touch " + flagFile), "ok"); + OK(getFromSocket("/dispatch plugin:test:keybind 1,7,29")); + EXPECT(attemptCheckFlag(20, 50), false); + OK(getFromSocket("/dispatch plugin:test:keybind 0,0,29")); + EXPECT(getFromSocket("/keyword unbind SUPER,Y"), "ok"); + + // With description + EXPECT(checkFlag(), false); + EXPECT(getFromSocket("/keyword binddk SUPER,Y,test-keyboard-1,test description,exec,touch " + flagFile), "ok"); + OK(getFromSocket("/dispatch plugin:test:keybind 1,7,29")); + EXPECT(attemptCheckFlag(20, 50), true); + OK(getFromSocket("/dispatch plugin:test:keybind 0,0,29")); + EXPECT(getFromSocket("/keyword unbind SUPER,Y"), "ok"); +} + static bool test() { NLog::log("{}Testing keybinds", Colors::GREEN); @@ -537,6 +565,7 @@ static bool test() { testSubmap(); testSubmapUniversal(); testBindsAfterScroll(); + testPerDeviceKeybind(); clearFlag(); return !ret; -- cgit v1.2.3