Skip to content

Commit

Permalink
#86 Add config option to disable Mod4 lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Rojetto committed Jul 12, 2023
1 parent 40c2fd1 commit 6bd44ad
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ ReNeo kann mit zwei Konfigurationsdateien angepasst werden.
]
```
- `"autoNumlock"`: Soll Numlock automatisch angeschaltet werden? Wenn die Tastatur einen echten Nummernblock besitzt, sollte diese Option für beste Kompatibilität immer auf `true` gesetzt sein. Bei Laptops mit nativer Numpad-Ebene auf dem Hauptfeld kann dieses Verhalten aber mit `false` deaktiviert werden.
- `"enableMod4Lock"`: Soll Mod4-Lock mit `LM4+RM4` aktiviert werden können? Kann abgestellt werden um unabsichtliches Aktivieren zu vermeiden.
- `"filterNeoModifiers"`:
- `true` (Standard): Die Tastenevents für M3 und M4 werden im Erweiterungsmodus von ReNeo weggefiltert, Anwendungen bekommen von diesen Tasten also nichts mit. Workaround für [diesen Bug](https://git.neo-layout.org/neo/neo-layout/issues/510).
- `false`: Anwendungen sehen M3/M4. Notwendig, wenn man in den Anwendungen mit diesen Tasten Optionen verknüpfen will.
Expand Down
1 change: 1 addition & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ ReNeo can be configured with two files.
]
```
- `"autoNumlock"`: Activate Numlock automatically? For optimal compatibility this should always be set to `true` if the keyboard has a real number pad. However, this may cause problems for laptops with a native number block located on the letter keys. In that case, disable this feature with `false`.
- `"enableMod4Lock"`: Should Mod4-lock be enabled with `LM4+RM4`? Can be disabled to prevent activating the lock on accident.
- `"filterNeoModifiers"`:
- `true` (false): Key events for M3 and M4 are filtered in extension mode so that other programs won't see these events. Workaround for [this Bug](https://git.neo-layout.org/neo/neo-layout/issues/510).
- `false`: Programs see M3/M4 events. Necessary if functions need to be bound in these applications.
Expand Down
1 change: 1 addition & 0 deletions config.3l.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"language": "english",
"filterNeoModifiers": true,
"autoNumlock": true,
"enableMod4Lock": true,
"osk": {
"numpad": false,
"theme": "Grey",
Expand Down
1 change: 1 addition & 0 deletions config.bone.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"language": "german",
"filterNeoModifiers": true,
"autoNumlock": true,
"enableMod4Lock": true,
"osk": {
"numpad": true,
"theme": "ColorClassic",
Expand Down
1 change: 1 addition & 0 deletions config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"language": "german",
"filterNeoModifiers": true,
"autoNumlock": true,
"enableMod4Lock": true,
"osk": {
"numpad": true,
"theme": "ColorClassic",
Expand Down
1 change: 1 addition & 0 deletions config.neo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"language": "german",
"filterNeoModifiers": true,
"autoNumlock": true,
"enableMod4Lock": true,
"osk": {
"numpad": true,
"theme": "ColorClassic",
Expand Down
1 change: 1 addition & 0 deletions config.neoqwertz.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"language": "german",
"filterNeoModifiers": true,
"autoNumlock": true,
"enableMod4Lock": true,
"osk": {
"numpad": true,
"theme": "Grey",
Expand Down
2 changes: 2 additions & 0 deletions source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ bool oskOpen;
bool configStandaloneMode;
NeoLayout *configStandaloneLayout;
bool configAutoNumlock;
bool configEnableMod4Lock;
bool configFilterNeoModifiers;
HotkeyConfig configHotkeyToggleActivation;
HotkeyConfig configHotkeyToggleOSK;
Expand Down Expand Up @@ -626,6 +627,7 @@ void initialize() {
}

configAutoNumlock = configJson["autoNumlock"].boolean;
configEnableMod4Lock = configJson["enableMod4Lock"].boolean;
configFilterNeoModifiers = configJson["filterNeoModifiers"].boolean;

// Parse hotkeys (might be null -> user doesn't want to use hotkey)
Expand Down
5 changes: 3 additions & 2 deletions source/reneo.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import core.sys.windows.windows;

import mapping;
import composer;
import app : configAutoNumlock, configFilterNeoModifiers, configOneHandedModeMirrorKey, configOneHandedModeMirrorMap, updateOSKAsync, toggleOSK, toggleOneHandedMode, lastInputLocale;
import app : configAutoNumlock, configEnableMod4Lock, configFilterNeoModifiers, configOneHandedModeMirrorKey, configOneHandedModeMirrorMap, updateOSKAsync, toggleOSK, toggleOneHandedMode, lastInputLocale;

const SC_FAKE_LSHIFT = 0x22A;
const SC_FAKE_RSHIFT = 0x236;
Expand Down Expand Up @@ -593,7 +593,8 @@ bool handleKeyEvent(Scancode scan, bool down) nothrow {

if (mod == Modifier.LMOD4 && !isModifierHeld(Modifier.LMOD4) && isModifierHeld(Modifier.RMOD4) ||
mod == Modifier.RMOD4 && !isModifierHeld(Modifier.RMOD4) && isModifierHeld(Modifier.LMOD4)) {
mod4Lock = !mod4Lock;
if (configEnableMod4Lock || mod4Lock) // always allow lock to be disabled
mod4Lock = !mod4Lock;
}
}

Expand Down

0 comments on commit 6bd44ad

Please sign in to comment.