1
+ # Set environment variables to suppress Jack errors before any imports
2
+ import os
3
+ # Tell Jack not to start if not available
4
+ os .environ ['JACK_NO_AUDIO_RESERVATION' ] = '1'
5
+ os .environ ['JACK_NO_START_SERVER' ] = '1'
6
+ # Explicitly ignore Jack - we'll use ALSA or PulseAudio instead
7
+ os .environ ['AUDIODEV' ] = 'null'
8
+
1
9
import sys
2
10
from PyQt6 .QtWidgets import (QApplication , QMessageBox , QSystemTrayIcon , QMenu )
3
11
from PyQt6 .QtCore import Qt , QTimer , QCoreApplication
12
20
from PyQt6 .QtCore import pyqtSignal
13
21
import warnings
14
22
import ctypes
15
- import os
16
23
from shortcuts import GlobalShortcuts
17
24
from settings import Settings
18
25
# from mic_debug import MicDebugWindow
21
28
logging .basicConfig (level = logging .INFO )
22
29
logger = logging .getLogger (__name__ )
23
30
24
- # Suppress ALSA error messages
25
- try :
26
- # Load ALSA error handler
27
- ERROR_HANDLER_FUNC = ctypes .CFUNCTYPE (None , ctypes .c_char_p , ctypes .c_int ,
28
- ctypes .c_char_p , ctypes .c_int ,
29
- ctypes .c_char_p )
30
-
31
- def py_error_handler (filename , line , function , err , fmt ):
32
- pass
31
+ # Log that Jack errors can be safely ignored
32
+ logger .info ("Note: Jack server errors can be safely ignored - using ALSA/PulseAudio instead" )
33
33
34
- c_error_handler = ERROR_HANDLER_FUNC (py_error_handler )
35
-
36
- # Set error handler
37
- asound = ctypes .cdll .LoadLibrary ('libasound.so.2' )
38
- asound .snd_lib_error_set_handler (c_error_handler )
39
- except :
40
- warnings .warn ("Failed to suppress ALSA warnings" , RuntimeWarning )
34
+ # Audio error handling is now done in recorder.py
35
+ # This comment is kept for documentation purposes
41
36
42
37
def check_dependencies ():
43
38
required_packages = ['whisper' , 'pyaudio' , 'keyboard' ]
@@ -80,7 +75,7 @@ def __init__(self):
80
75
# self.debug_window = MicDebugWindow()
81
76
82
77
# Set tooltip
83
- self .setToolTip ("Telly Spelly " )
78
+ self .setToolTip ("Syllablaze " )
84
79
85
80
# Enable activation by left click
86
81
self .activated .connect (self .on_activate )
@@ -93,11 +88,11 @@ def __init__(self):
93
88
def initialize (self ):
94
89
"""Initialize the tray recorder after showing loading window"""
95
90
# Set application icon
96
- self .app_icon = QIcon .fromTheme ("telly-spelly " )
91
+ self .app_icon = QIcon .fromTheme ("syllablaze " )
97
92
if self .app_icon .isNull ():
98
93
# Fallback to theme icons if custom icon not found
99
94
self .app_icon = QIcon .fromTheme ("media-record" )
100
- logger .warning ("Could not load telly-spelly icon, using system theme icon" )
95
+ logger .warning ("Could not load syllablaze icon, using system theme icon" )
101
96
102
97
# Set the icon for both app and tray
103
98
QApplication .instance ().setWindowIcon (self .app_icon )
@@ -271,6 +266,10 @@ def handle_recording_error(self, error):
271
266
def update_processing_status (self , status ):
272
267
if self .progress_window :
273
268
self .progress_window .set_status (status )
269
+
270
+ def update_processing_progress (self , percent ):
271
+ if self .progress_window :
272
+ self .progress_window .update_progress (percent )
274
273
275
274
def handle_transcription_finished (self , text ):
276
275
if text :
@@ -311,7 +310,7 @@ def toggle_debug_window(self):
311
310
self .debug_action .setText ("Hide Debug Window" )
312
311
313
312
def setup_application_metadata ():
314
- QCoreApplication .setApplicationName ("Telly Spelly " )
313
+ QCoreApplication .setApplicationName ("Syllablaze " )
315
314
QCoreApplication .setApplicationVersion ("1.0" )
316
315
QCoreApplication .setOrganizationName ("KDE" )
317
316
QCoreApplication .setOrganizationDomain ("kde.org" )
@@ -364,32 +363,40 @@ def initialize_tray(tray, loading_window, app):
364
363
try :
365
364
# Initialize basic tray setup
366
365
loading_window .set_status ("Initializing application..." )
366
+ loading_window .set_progress (10 )
367
367
app .processEvents ()
368
368
tray .initialize ()
369
369
370
370
# Initialize recorder
371
371
loading_window .set_status ("Initializing audio system..." )
372
+ loading_window .set_progress (25 )
372
373
app .processEvents ()
373
374
tray .recorder = AudioRecorder ()
374
375
375
376
# Initialize transcriber
376
- loading_window .set_status ("Loading Whisper model..." )
377
+ loading_window .set_status ("Loading Whisper model: turbo" )
378
+ loading_window .set_progress (40 )
377
379
app .processEvents ()
378
380
tray .transcriber = WhisperTranscriber ()
381
+ loading_window .set_progress (80 )
382
+ app .processEvents ()
379
383
380
384
# Connect signals
381
385
loading_window .set_status ("Setting up signal handlers..." )
386
+ loading_window .set_progress (90 )
382
387
app .processEvents ()
383
388
tray .recorder .volume_updated .connect (tray .update_volume_meter )
384
389
tray .recorder .recording_finished .connect (tray .handle_recording_finished )
385
390
tray .recorder .recording_error .connect (tray .handle_recording_error )
386
391
387
392
tray .transcriber .transcription_progress .connect (tray .update_processing_status )
393
+ tray .transcriber .transcription_progress_percent .connect (tray .update_processing_progress )
388
394
tray .transcriber .transcription_finished .connect (tray .handle_transcription_finished )
389
395
tray .transcriber .transcription_error .connect (tray .handle_transcription_error )
390
396
391
397
# Make tray visible
392
398
loading_window .set_status ("Starting application..." )
399
+ loading_window .set_progress (100 )
393
400
app .processEvents ()
394
401
tray .setVisible (True )
395
402
0 commit comments