mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 08:45:58 +01:00
Merge pull request #47 from sixels/input_config
Add more input configurations
This commit is contained in:
commit
b8d88cff79
3 changed files with 26 additions and 2 deletions
|
@ -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);
|
||||
if (currentCategory.length() != 0) {
|
||||
currentCategory.push_back(':');
|
||||
currentCategory.append(cat);
|
||||
}
|
||||
else {
|
||||
currentCategory = cat;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ input {
|
|||
kb_model=
|
||||
kb_options=
|
||||
kb_rules=
|
||||
repeat_rate=
|
||||
repeat_delay=
|
||||
|
||||
touchpad {
|
||||
disable_while_typing=
|
||||
}
|
||||
}
|
||||
|
||||
general {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue