Remove context capture
This commit is contained in:
parent
f826617ed4
commit
3b7fa236b4
5 changed files with 1 additions and 99 deletions
35
src/leld.py
35
src/leld.py
|
|
@ -13,7 +13,6 @@ from config import Config, load, redacted_dict
|
|||
from recorder import start_recording, stop_recording
|
||||
from stt import FasterWhisperSTT, STTConfig
|
||||
from aiprocess import AIConfig, build_processor
|
||||
from context import I3Provider
|
||||
from inject import inject
|
||||
from x11_hotkey import listen
|
||||
from tray import run_tray
|
||||
|
|
@ -35,8 +34,6 @@ class Daemon:
|
|||
self.proc = None
|
||||
self.record = None
|
||||
self.timer = None
|
||||
self.context = None
|
||||
self.context_provider = I3Provider()
|
||||
self.stt = FasterWhisperSTT(
|
||||
STTConfig(
|
||||
model=cfg.transcribing.get("model", "base"),
|
||||
|
|
@ -75,23 +72,6 @@ class Daemon:
|
|||
except Exception as exc:
|
||||
logging.error("record start failed: %s", exc)
|
||||
return
|
||||
try:
|
||||
if self.context_provider:
|
||||
self.context = self.context_provider.capture()
|
||||
except Exception as exc:
|
||||
logging.error("context capture failed: %s", exc)
|
||||
self.context = None
|
||||
if self.context:
|
||||
logging.info(
|
||||
"context: id=%s app_id=%s class=%s instance=%s title=%s",
|
||||
self.context.window_id,
|
||||
self.context.app_id,
|
||||
self.context.klass,
|
||||
self.context.instance,
|
||||
self.context.title,
|
||||
)
|
||||
else:
|
||||
logging.info("context: none")
|
||||
self.proc = proc
|
||||
self.record = record
|
||||
self.state = State.RECORDING
|
||||
|
|
@ -179,11 +159,6 @@ class Daemon:
|
|||
try:
|
||||
self.set_state(State.OUTPUTTING)
|
||||
logging.info("outputting started")
|
||||
if self.context_provider and self.context:
|
||||
if not self.context_provider.is_same_focus(self.context):
|
||||
logging.info("focus changed, aborting injection")
|
||||
self.set_state(State.IDLE)
|
||||
return
|
||||
backend = self.cfg.injection.get("backend", "clipboard")
|
||||
inject(text, backend)
|
||||
except Exception as exc:
|
||||
|
|
@ -191,16 +166,6 @@ class Daemon:
|
|||
finally:
|
||||
self.set_state(State.IDLE)
|
||||
|
||||
def _context_json(self, ctx):
|
||||
if not ctx:
|
||||
return None
|
||||
return {
|
||||
"window_id": ctx.window_id,
|
||||
"app_id": ctx.app_id,
|
||||
"class": ctx.klass,
|
||||
"instance": ctx.instance,
|
||||
"title": ctx.title,
|
||||
}
|
||||
|
||||
def stop_recording(self):
|
||||
with self.lock:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue