summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-19 19:33:13 +0200
committerGitHub <noreply@github.com>2022-04-19 19:33:13 +0200
commitb8d88cff7933475b2dc310e741f8fa07c96c8d0d (patch)
tree86a5ff14d933e9a5af0e63909760970a2c15522f
parent08ee14b4a0a93793f0f65295056889597ea8af56 (diff)
parentb7bcd5cb8f2fda4e2ef5c18907eb3c4d9fa73e8a (diff)
Merge pull request #47 from sixels/input_config
Add more input configurations
-rw-r--r--src/config/ConfigManager.cpp12
-rw-r--r--src/config/defaultConfig.hpp6
-rw-r--r--src/managers/InputManager.cpp10
3 files changed, 26 insertions, 2 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index b2af4eea..74bc2fab 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -55,6 +55,9 @@ void CConfigManager::setDefaultVars() {
configValues["input:kb_options"].strValue = "";
configValues["input:kb_rules"].strValue = "";
configValues["input:kb_model"].strValue = "";
+ configValues["input:repeat_rate"].intValue = 25;
+ configValues["input:repeat_delay"].intValue = 600;
+ configValues["input:touchpad:disable_while_typing"].intValue = 1;
configValues["input:follow_mouse"].intValue = 1;
@@ -260,7 +263,14 @@ void CConfigManager::parseLine(std::string& line) {
if (line.find(" {") != std::string::npos) {
auto cat = line.substr(0, line.find(" {"));
transform(cat.begin(), cat.end(), cat.begin(), ::tolower);
- currentCategory = cat;
+ if (currentCategory.length() != 0) {
+ currentCategory.push_back(':');
+ currentCategory.append(cat);
+ }
+ else {
+ currentCategory = cat;
+ }
+
return;
}
diff --git a/src/config/defaultConfig.hpp b/src/config/defaultConfig.hpp
index 550d0601..98e32d33 100644
--- a/src/config/defaultConfig.hpp
+++ b/src/config/defaultConfig.hpp
@@ -19,6 +19,12 @@ input {
kb_model=
kb_options=
kb_rules=
+ repeat_rate=
+ repeat_delay=
+
+ touchpad {
+ disable_while_typing=
+ }
}
general {
diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp
index 0800ac95..219acdac 100644
--- a/src/managers/InputManager.cpp
+++ b/src/managers/InputManager.cpp
@@ -206,10 +206,13 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
const auto CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
const auto KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
+ const auto REPEATRATE = g_pConfigManager->getInt("input:repeat_rate");
+ const auto REPEATDELAY = g_pConfigManager->getInt("input:repeat_delay");
+
wlr_keyboard_set_keymap(keyboard->keyboard, KEYMAP);
xkb_keymap_unref(KEYMAP);
xkb_context_unref(CONTEXT);
- wlr_keyboard_set_repeat_info(keyboard->keyboard, 25, 600);
+ wlr_keyboard_set_repeat_info(keyboard->keyboard, std::max(0, REPEATRATE), std::max(0, REPEATDELAY));
PNEWKEYBOARD->hyprListener_keyboardMod.initCallback(&keyboard->keyboard->events.modifiers, &Events::listener_keyboardMod, PNEWKEYBOARD, "Keyboard");
PNEWKEYBOARD->hyprListener_keyboardKey.initCallback(&keyboard->keyboard->events.key, &Events::listener_keyboardKey, PNEWKEYBOARD, "Keyboard");
@@ -271,6 +274,11 @@ void CInputManager::newMouse(wlr_input_device* mouse) {
if (libinput_device_config_scroll_has_natural_scroll(LIBINPUTDEV))
libinput_device_config_scroll_set_natural_scroll_enabled(LIBINPUTDEV, 0 /* Natural */);
+
+ if (libinput_device_config_dwt_is_available(LIBINPUTDEV)) {
+ const auto DWT = static_cast<enum libinput_config_dwt_state>(g_pConfigManager->getInt("input:touchpad:disable_while_typing") != 0);
+ libinput_device_config_dwt_set_enabled(LIBINPUTDEV, DWT);
+ }
}
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);