stttype 2.0.0__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stttype
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Cross-platform voice-to-text typing assistant with GPU acceleration and automatic CPU fallback
5
5
  Author: LucasApps
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "stttype"
7
- version = "2.0.0"
7
+ version = "2.0.2"
8
8
  description = "Cross-platform voice-to-text typing assistant with GPU acceleration and automatic CPU fallback"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -83,17 +83,47 @@ def cmd_start(args):
83
83
  print("[WARN] STT Type is already running!")
84
84
  return 1
85
85
 
86
+ # Load config to get defaults if CLI args not provided
87
+ from stttype.config_ui import load_config
88
+ config = load_config()
89
+
90
+ model = args.model if args.model else config.get("model", "base")
91
+ lang = args.lang if args.lang else config.get("language", "en")
92
+
86
93
  print("[INFO] Starting STT Type in background...")
87
- print(f" Model: {args.model} | Language: {args.lang}")
94
+ print(f" Model: {model} | Language: {lang}")
88
95
 
89
96
  try:
90
97
  python_exe = _get_python_exe()
91
98
  main_script = _get_main_script()
92
99
 
100
+ # Prepare environment - copy current env and add DISPLAY if needed
101
+ env = os.environ.copy()
102
+ if IS_LINUX and "DISPLAY" not in env:
103
+ # Try to detect DISPLAY from logged-in users
104
+ try:
105
+ result = subprocess.run(
106
+ ["who"], capture_output=True, text=True, timeout=2
107
+ )
108
+ for line in result.stdout.splitlines():
109
+ if ":" in line:
110
+ parts = line.split()
111
+ for p in parts:
112
+ if p.startswith(":"):
113
+ env["DISPLAY"] = p
114
+ break
115
+ break
116
+ except Exception:
117
+ pass
118
+ # Fallback to :0
119
+ if "DISPLAY" not in env:
120
+ env["DISPLAY"] = ":0"
121
+
93
122
  popen_kwargs = {
94
123
  "cwd": PROJECT_ROOT,
95
124
  "stdout": subprocess.DEVNULL,
96
125
  "stderr": subprocess.DEVNULL,
126
+ "env": env,
97
127
  }
98
128
 
99
129
  if IS_WINDOWS:
@@ -103,7 +133,7 @@ def cmd_start(args):
103
133
  popen_kwargs["start_new_session"] = True
104
134
 
105
135
  subprocess.Popen(
106
- [python_exe, main_script, "--tray", "--model", args.model, "--lang", args.lang],
136
+ [python_exe, main_script, "--tray", "--model", model, "--lang", lang],
107
137
  **popen_kwargs
108
138
  )
109
139
 
@@ -17,6 +17,7 @@ class KeyboardTyper:
17
17
  def type_text(self, text):
18
18
  """
19
19
  Type text using virtual keyboard.
20
+ Uses clipboard paste for reliability (avoids key interference).
20
21
 
21
22
  Args:
22
23
  text: String to type
@@ -24,31 +25,31 @@ class KeyboardTyper:
24
25
  if not text:
25
26
  return
26
27
 
27
- # Small delay to let user release F2 key completely
28
- time.sleep(0.2)
29
-
30
- # Type the text
31
- pyautogui.typewrite(text, interval=self.typing_delay)
32
-
33
- def type_text_instant(self, text):
34
- """Type text with clipboard paste (faster for long text)."""
35
- if not text:
36
- return
37
-
38
28
  import pyperclip
39
29
 
40
30
  # Save original clipboard
41
31
  original = pyperclip.paste()
42
32
 
43
33
  try:
44
- # Copy text to clipboard and paste
34
+ # Copy text to clipboard
45
35
  pyperclip.copy(text)
46
- time.sleep(0.1)
36
+ time.sleep(0.15)
37
+
38
+ # Paste with Ctrl+V
47
39
  pyautogui.keyDown('ctrl')
48
40
  pyautogui.keyDown('v')
49
41
  pyautogui.keyUp('v')
50
42
  pyautogui.keyUp('ctrl')
51
- time.sleep(0.1)
43
+ time.sleep(0.15)
52
44
  finally:
53
45
  # Restore original clipboard
54
46
  pyperclip.copy(original)
47
+
48
+ def type_text_slow(self, text):
49
+ """Type text character by character (slower but works everywhere)."""
50
+ if not text:
51
+ return
52
+
53
+ # Longer delay to ensure hotkey is fully released
54
+ time.sleep(0.5)
55
+ pyautogui.typewrite(text, interval=self.typing_delay)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stttype
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Cross-platform voice-to-text typing assistant with GPU acceleration and automatic CPU fallback
5
5
  Author: LucasApps
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes