summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-02 19:47:11 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-02 19:47:11 +0200
commit601abc7e92521534d0ff7137275988555c561c36 (patch)
tree7611278c351e46b60c9ad974b252dcfbedbbffd1 /src
parentf5cdb5b95e13928316e83c32f0351654734a2bde (diff)
Added locking numlock
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/helpers/MiscFunctions.cpp2
-rw-r--r--src/managers/InputManager.cpp14
3 files changed, 16 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index f66e7085..1a36b483 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -80,6 +80,7 @@ void CConfigManager::setDefaultVars() {
configValues["input:repeat_rate"].intValue = 25;
configValues["input:repeat_delay"].intValue = 600;
configValues["input:natural_scroll"].intValue = 0;
+ configValues["input:numlock_by_default"].intValue = 0;
configValues["input:touchpad:disable_while_typing"].intValue = 1;
configValues["input:follow_mouse"].intValue = 1;
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 2cdadbc8..4e9cbed4 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -191,7 +191,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
searchID = lowestID;
}
- if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE && PWORKSPACE->m_iID != SPECIAL_WORKSPACE_ID) {
+ if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE 11&& PWORKSPACE->m_iID != SPECIAL_WORKSPACE_ID) {
if (PWORKSPACE->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID) {
currentID = PWORKSPACE->m_iID;
diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp
index e27e82ce..d206cd7d 100644
--- a/src/managers/InputManager.cpp
+++ b/src/managers/InputManager.cpp
@@ -289,6 +289,20 @@ void CInputManager::setKeyboardLayout() {
for (auto& k : m_lKeyboards)
wlr_keyboard_set_keymap(k.keyboard->keyboard, KEYMAP);
+ wlr_keyboard_modifiers wlrMods = {0};
+
+ if (g_pConfigManager->getInt("input:numlock_by_default") == 1) {
+ // lock numlock
+ const auto IDX = xkb_map_mod_get_index(KEYMAP, XKB_MOD_NAME_NUM);
+
+ if (IDX != XKB_MOD_INVALID)
+ wlrMods.locked |= (uint32_t)1 << IDX;
+ }
+
+ if (wlrMods.locked != 0) {
+ wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &wlrMods);
+ }
+
xkb_keymap_unref(KEYMAP);
xkb_context_unref(CONTEXT);