Work on tightening up keyboard handling.

This commit is contained in:
Storm Dragon
2026-05-12 16:06:31 -04:00
parent ab7818fd4c
commit 4022fc4006
3 changed files with 90 additions and 4 deletions
@@ -22,7 +22,10 @@ class command:
return _("sends the following keypress to the terminal or application")
def run(self):
self.env["input"]["key_forward"] = 3
if self.env["runtime"]["InputManager"].no_key_pressed():
self.env["input"]["key_forward"] = 1
else:
self.env["input"]["key_forward"] = -1
self.env["runtime"]["OutputManager"].present_text(
_("Forward next keypress"), interrupt=True
)
+10 -3
View File
@@ -126,8 +126,7 @@ class FenrirManager:
self.environment["runtime"]["InputManager"].write_event_buffer()
self.environment["runtime"]["InputManager"].handle_device_grab()
if self.environment["input"]["key_forward"] > 0:
self.environment["input"]["key_forward"] -= 1
self.update_key_forward()
self.environment["runtime"]["CommandManager"].execute_default_trigger(
"onKeyInput"
@@ -260,7 +259,7 @@ class FenrirManager:
)
def detect_shortcut_command(self):
if self.environment["input"]["key_forward"] > 0:
if self.environment["input"]["key_forward"] != 0:
return
if len(self.environment["input"]["prev_input"]) > len(
@@ -324,6 +323,14 @@ class FenrirManager:
)
self.command = ""
def update_key_forward(self):
key_forward = self.environment["input"]["key_forward"]
input_manager = self.environment["runtime"]["InputManager"]
if key_forward == -1 and input_manager.no_key_pressed():
self.environment["input"]["key_forward"] = 1
elif key_forward == 1 and input_manager.no_key_pressed():
self.environment["input"]["key_forward"] = 0
def set_process_name(self, name="fenrir"):
"""Attempts to set the process name to 'fenrir'."""
try: