-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added proper synchronization. Fixed libinput.
Fixed circular import.
- Loading branch information
Patrick Lenihan
committed
Feb 9, 2025
1 parent
d1785ba
commit 512f2af
Showing
8 changed files
with
401 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
Listeners for aggregated keyboard and mouse events. | ||
This is used for AFK detection on Linux, as well as used in aw-watcher-input to track input activity in general. | ||
NOTE: Logging usage should be commented out before committed, for performance reasons. | ||
""" | ||
|
||
|
||
""" | ||
Listeners for aggregated keyboard and mouse events. | ||
This is used for AFK detection on Linux, as well as used in aw-watcher-input to track input activity in general. | ||
NOTE: Logging usage should be commented out before committed, for performance reasons. | ||
""" | ||
|
||
import logging | ||
from abc import ABCMeta, abstractmethod | ||
|
||
logger = logging.getLogger(__name__) | ||
# logger.setLevel(logging.DEBUG) | ||
|
||
class BaseEventFactory(metaclass=ABCMeta): | ||
|
||
@abstractmethod | ||
def next_event(self): | ||
"""Returns new event data""" | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
def start(self): | ||
"""Starts monitoring events in the background""" | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
def has_new_event(self) -> bool: | ||
"""Has new event data""" | ||
raise NotImplementedError | ||
|
||
def main_test(listener): | ||
|
||
listener.start() | ||
|
||
while True: | ||
|
||
if listener.has_new_event(): | ||
print(listener.next_event()) |
Oops, something went wrong.