From 03624e206009e5c1c14a2ad48e37865ec7741e00 Mon Sep 17 00:00:00 2001 From: Sixels Date: Tue, 19 Apr 2022 13:42:26 -0300 Subject: [PATCH 1/5] Handle subcategories --- src/config/ConfigManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 30585502..cf2ad8fe 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -260,7 +260,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; } From 613093877a34dca5a9927811f05432c01f74b01e Mon Sep 17 00:00:00 2001 From: Sixels Date: Tue, 19 Apr 2022 13:50:18 -0300 Subject: [PATCH 2/5] Set dwt for touchpad if available --- src/managers/InputManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index 0800ac95..43b4ec12 100644 --- a/src/managers/InputManager.cpp +++ b/src/managers/InputManager.cpp @@ -271,6 +271,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(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); From c0645c393b317e419c668e8c19c754488415f85b Mon Sep 17 00:00:00 2001 From: Sixels Date: Tue, 19 Apr 2022 13:51:00 -0300 Subject: [PATCH 3/5] Set keyboard repeat rate and delay from config --- src/managers/InputManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index 43b4ec12..4d2c7b10 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, REPEATRATE, 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"); From 6719574f0cbe643bc213630ccc0d6ff3dc6faf59 Mon Sep 17 00:00:00 2001 From: Sixels Date: Tue, 19 Apr 2022 13:51:53 -0300 Subject: [PATCH 4/5] Add input options to config --- src/config/ConfigManager.cpp | 3 +++ src/config/defaultConfig.hpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cf2ad8fe..4d8affec 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; 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 { From b7bcd5cb8f2fda4e2ef5c18907eb3c4d9fa73e8a Mon Sep 17 00:00:00 2001 From: Sixels Date: Tue, 19 Apr 2022 14:14:46 -0300 Subject: [PATCH 5/5] Handle negative delay and rate --- src/managers/InputManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index 4d2c7b10..219acdac 100644 --- a/src/managers/InputManager.cpp +++ b/src/managers/InputManager.cpp @@ -212,7 +212,7 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) { wlr_keyboard_set_keymap(keyboard->keyboard, KEYMAP); xkb_keymap_unref(KEYMAP); xkb_context_unref(CONTEXT); - wlr_keyboard_set_repeat_info(keyboard->keyboard, REPEATRATE, REPEATDELAY); + 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");