input-remapper
input-remapper copied to clipboard
Make stopping and resuming of injection automatic when recording input.
When pressing the 'Record' button while an injection is currently running, it should stop automatically, and once the recording is finished, injection should auto-start automatically.
This can be done in the inputremapper/gui/controller.py class and the start_key_recording(self) function, as such: I've created comments for new lines and removed some lines that would not be needed anymore.
def start_key_recording(self):
"""Record the input of the active_group
Updates the active_mapping.input_combination with the recorded events.
"""
state = self.data_manager.get_state()
if state == InjectorState.RUNNING or state == InjectorState.STARTING:
# Store current running preset in a variable (previous_preset)
# Stop injection
# else:
# Set previous_preset variable to null
logger.debug("Recording Keys")
def on_recording_finished(_):
self.message_broker.unsubscribe(on_recording_finished)
self.message_broker.unsubscribe(self._on_combination_recorded)
self.gui.connect_shortcuts()
# If previous_preset variable is assigned:
# Start injection of previous preset
self.gui.disconnect_shortcuts()
self.message_broker.subscribe(
MessageType.combination_recorded,
self._on_combination_recorded,
)
self.message_broker.subscribe(
MessageType.recording_finished, on_recording_finished
)
self.data_manager.start_combination_recording()
Now, I've tried doing this myself, but the last time I tried cloning the repo and compiling the source, I completely destroyed my Linux installation and couldn't find the cause and revert my damage, had to reinstall everything, this is why I've created this issue.