summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArchSav <96357545+ArchSav@users.noreply.github.com>2026-05-06 01:30:19 +1000
committerGitHub <noreply@github.com>2026-05-05 16:30:19 +0100
commit497b48e8520e4beac16a1a209551c3db46a6d917 (patch)
treed1314e40e8c816b229b189897a3852ee1f231226 /src
parenteff3bfe261e90b8950b59379ca7815f735a7aab6 (diff)
config: add device tags (#13728)
--------- Co-authored-by: Mio Argillander <mio@argillander.me>
Diffstat (limited to 'src')
-rw-r--r--src/config/legacy/ConfigManager.cpp1
-rw-r--r--src/config/lua/bindings/LuaBindingsConfigRules.cpp1
-rw-r--r--src/devices/IHID.hpp6
-rw-r--r--src/managers/KeybindManager.cpp7
-rw-r--r--src/managers/input/InputManager.cpp8
5 files changed, 20 insertions, 3 deletions
diff --git a/src/config/legacy/ConfigManager.cpp b/src/config/legacy/ConfigManager.cpp
index 37b819e3..e4c485e0 100644
--- a/src/config/legacy/ConfigManager.cpp
+++ b/src/config/legacy/ConfigManager.cpp
@@ -555,6 +555,7 @@ CConfigManager::CConfigManager() {
m_config->addSpecialConfigValue("device", "keybinds", Hyprlang::INT{1}); // enable/disable keybinds
m_config->addSpecialConfigValue("device", "share_states", Hyprlang::INT{0}); // only for virtualkeyboards
m_config->addSpecialConfigValue("device", "release_pressed_on_close", Hyprlang::INT{0}); // only for virtualkeyboards
+ m_config->addSpecialConfigValue("device", "tags", STRVAL_EMPTY); // only for keyboards and mice
m_config->addSpecialCategory("monitorv2", {.key = "output"});
m_config->addSpecialConfigValue("monitorv2", "disabled", Hyprlang::INT{0});
diff --git a/src/config/lua/bindings/LuaBindingsConfigRules.cpp b/src/config/lua/bindings/LuaBindingsConfigRules.cpp
index 14e17264..51548c04 100644
--- a/src/config/lua/bindings/LuaBindingsConfigRules.cpp
+++ b/src/config/lua/bindings/LuaBindingsConfigRules.cpp
@@ -265,6 +265,7 @@ namespace {
{"keybinds", []() -> ILuaConfigValue* { return new CLuaConfigBool(true); }},
{"share_states", []() -> ILuaConfigValue* { return new CLuaConfigInt(0, 0, 2); }},
{"release_pressed_on_close", []() -> ILuaConfigValue* { return new CLuaConfigBool(false); }},
+ {"tags", []() -> ILuaConfigValue* { return new CLuaConfigString(STRVAL_EMPTY); }},
};
}
diff --git a/src/devices/IHID.hpp b/src/devices/IHID.hpp
index c57778ff..eae2f965 100644
--- a/src/devices/IHID.hpp
+++ b/src/devices/IHID.hpp
@@ -2,6 +2,7 @@
#include <cstdint>
#include <string>
+#include <set>
#include "../helpers/signal/Signal.hpp"
enum eHIDCapabilityType : uint8_t {
@@ -36,6 +37,7 @@ class IHID {
CSignalT<> destroy;
} m_events;
- std::string m_deviceName;
- std::string m_hlName;
+ std::string m_deviceName;
+ std::string m_hlName;
+ std::set<std::string> m_deviceTags;
};
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 2496a0a5..c9b5650a 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -605,7 +605,12 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
continue;
if (device) {
- if (k->deviceInclusive ^ k->devices.contains(device->m_hlName))
+ bool isTagValid = false;
+ for (const auto& tag : device->m_deviceTags) {
+ if (k->devices.contains(tag))
+ isTagValid = true;
+ }
+ if (k->deviceInclusive ^ (k->devices.contains(device->m_hlName) || isTagValid))
continue;
}
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 65a98181..85699b14 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1167,6 +1167,10 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
const auto ENABLED = HASCONFIG && Config::mgr()->deviceConfigExplicitlySet(devname, "enabled") ? Config::mgr()->getDeviceInt(devname, "enabled") : true;
const auto ALLOWBINDS = HASCONFIG && Config::mgr()->deviceConfigExplicitlySet(devname, "keybinds") ? Config::mgr()->getDeviceInt(devname, "keybinds") : true;
+ for (const auto& tagString : CVarList2(Config::mgr()->getDeviceString(devname, "tags"))) {
+ pKeyboard->m_deviceTags.emplace(std::string_view(tagString));
+ }
+
pKeyboard->m_enabled = ENABLED;
pKeyboard->m_resolveBindsBySym = RESOLVEBINDSBYSYM;
pKeyboard->m_allowBinds = ALLOWBINDS;
@@ -1293,6 +1297,10 @@ void CInputManager::setPointerConfigs() {
g_pPointerManager->detachPointer(m);
m->m_connected = false;
}
+
+ for (const auto tagString : CVarList2(Config::mgr()->getDeviceString(devname, "tags"))) {
+ m->m_deviceTags.emplace(std::string_view(tagString));
+ }
}
if (Config::mgr()->deviceConfigExplicitlySet(devname, "scroll_factor"))