doc updates based on the comments and refactoring
This commit is contained in:
parent
660b751c87
commit
609e275c03
@ -1,6 +1,6 @@
|
||||
# Sticky Mod
|
||||
This module allows to immitate the behaviour of ATL+TAB or CMD+TAB, etc. for switching between open windows.
|
||||
The mod will be on hold and the key will be tapped. The mod will be released when any other key is pressed or the layer key is released.
|
||||
This module allows to hold a modifier while a key is being tapped repeatedly; the modifier will be released when any other key is pressed or released.
|
||||
This is for example useful if you want to switch between open windows with ALT+TAB or CMD+TAB, using only a single key.
|
||||
|
||||
## Enabling the module
|
||||
```python
|
||||
|
@ -26,10 +26,9 @@ class StickyMod(Module):
|
||||
return
|
||||
|
||||
def process_key(self, keyboard, key, is_pressed, int_coord):
|
||||
if self._active:
|
||||
# release previous key if any other key is pressed
|
||||
if self._active_key is not None:
|
||||
self.release_key(keyboard, self._active_key)
|
||||
# release previous key if any other key is pressed
|
||||
if self._active and self._active_key is not None:
|
||||
self.release_key(keyboard, self._active_key)
|
||||
|
||||
return key
|
||||
|
||||
@ -54,10 +53,6 @@ class StickyMod(Module):
|
||||
self._active_key = None
|
||||
|
||||
def sm_pressed(self, key, keyboard, *args, **kwargs):
|
||||
if self._active and self._active_key is not None:
|
||||
# release previous key
|
||||
self.release_key(keyboard, self._active_key)
|
||||
|
||||
keyboard.process_key(key.meta.mod, True)
|
||||
keyboard.process_key(key.meta.kc, True)
|
||||
self._active_key = key
|
||||
|
Loading…
Reference in New Issue
Block a user