Skip to content

Commit 4ff9bb4

Browse files
Use Gio.Subprocess
Add extra visual indication (widget color change during recording)
1 parent 368b40a commit 4ff9bb4

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

extension.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,18 @@ function enable() {
4343
settings,
4444
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
4545
Shell.ActionMode.NORMAL,
46-
() => {GLib.spawn_command_line_async(homeDir+"/"+asr_path);}
47-
);
48-
46+
async() => { try {
47+
siLabel.set_style_class_name('i-label');
48+
const proc = Gio.Subprocess.new([homeDir+"/"+asr_path],
49+
Gio.SubprocessFlags.NONE);
50+
const success = await proc.wait_check_async(null);
51+
//console.log(`Speech recognizer ${success ? 'succeeded' : 'failed'}`);
52+
siLabel.set_style_class_name(success ? 'si-label' : 'e-label');
53+
} catch (e) {
54+
logError(e);
55+
}
56+
}
57+
);
4958
}
5059

5160
function disable() {

prefs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ When the microphone icon disappears, the transcribed text can be pasted immediat
4545
* Edit the configuration section of the <b>wsi</b> script to match your environment, point to the Whisper model of choice, etc.\n\n \
4646
* Check the gschema.xml file for the invocation keyboard shortcut and modify the key combination if needed.\n \
4747
The schema then has to be recompiled with '<b>glib-compile-schemas schemas/</b>' from the command line in the extension folder.\n\n \
48-
* Note that depending on noise environment, the silence level may need to be adjusted in the '<b>sox</b>' command.\n\n \
48+
* Note that depending on noise environment, the silence threshold may need to be adjusted in the '<b>sox</b>' command.\n\n \
4949
More details and instructions on <a href='https://github.com/QuantiusBenignus/blurt'>GitHub</a>\n \
5050
2024, \u{00A9}<a href='https://github.com/QuantiusBenignus'>Quantius Benignus</a>" );
5151
textL.set_name("i-label");

stylesheet.css

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
}
1212

1313
.i-label {
14+
color: yellow;
1415
font-size: 16px;
15-
font-weight: bold;
16+
padding: 2px;
17+
border-radius: 2px;
18+
}
19+
20+
.e-label {
21+
color: red;
22+
font-size: 16px;
23+
padding: 2px;
24+
border-radius: 2px;
1625
}

0 commit comments

Comments
 (0)