-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
563 lines (472 loc) · 17.6 KB
/
Copy pathinstall.sh
File metadata and controls
563 lines (472 loc) · 17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
#!/usr/bin/env bash
set -euo pipefail
VERBATIM_REPO_OWNER="${VERBATIM_REPO_OWNER:-MagnetosphereLabs}"
VERBATIM_REPO_NAME="${VERBATIM_REPO_NAME:-Verbatim}"
VERBATIM_BRANCH="${VERBATIM_BRANCH:-main}"
if [ "$(id -u)" -eq 0 ]; then
echo "Do not run this installer with sudo."
echo
echo "Use:"
echo " curl -fsSL https://raw.githubusercontent.com/${VERBATIM_REPO_OWNER}/${VERBATIM_REPO_NAME}/${VERBATIM_BRANCH}/install.sh | bash"
echo
echo "Reason: Verbatim installs a user service, user shortcut, and files under the desktop user's home directory."
echo "The installer will ask for sudo internally when system packages or input-device permissions are needed."
exit 1
fi
SCRIPT_SOURCE="${BASH_SOURCE[0]:-$0}"
if [ -f "$SCRIPT_SOURCE" ]; then
ROOT="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
else
ROOT="$(pwd)"
fi
if [ ! -d "$ROOT/app" ] || [ ! -d "$ROOT/bin" ] || [ ! -d "$ROOT/scripts" ] || [ ! -f "$ROOT/requirements.txt" ]; then
if [ "${VERBATIM_BOOTSTRAPPED:-0}" != "1" ]; then
echo "Verbatim bootstrap installer"
echo "Fetching ${VERBATIM_REPO_OWNER}/${VERBATIM_REPO_NAME}@${VERBATIM_BRANCH}..."
TMPDIR_INSTALL="$(mktemp -d "${TMPDIR:-/tmp}/verbatim-install.XXXXXXXX")"
cleanup() {
rm -rf "$TMPDIR_INSTALL"
}
trap cleanup EXIT
ARCHIVE_URL="https://github.com/${VERBATIM_REPO_OWNER}/${VERBATIM_REPO_NAME}/archive/refs/heads/${VERBATIM_BRANCH}.tar.gz"
curl -fsSL "$ARCHIVE_URL" -o "$TMPDIR_INSTALL/verbatim.tar.gz"
tar -xzf "$TMPDIR_INSTALL/verbatim.tar.gz" -C "$TMPDIR_INSTALL"
FETCHED_ROOT="$(find "$TMPDIR_INSTALL" -mindepth 1 -maxdepth 1 -type d -name "${VERBATIM_REPO_NAME}-*" | head -n1)"
if [ -z "$FETCHED_ROOT" ] || [ ! -f "$FETCHED_ROOT/install.sh" ]; then
echo "Could not locate fetched Verbatim installer." >&2
exit 1
fi
export VERBATIM_BOOTSTRAPPED=1
exec bash "$FETCHED_ROOT/install.sh" "$@"
fi
echo "Installer is missing required project files: app/, bin/, scripts/, requirements.txt" >&2
exit 1
fi
APP="$HOME/.local/share/kdictate-cosmic"
BIN="$HOME/.local/bin"
LOG="$APP/install.log"
SERVICE_DIR="$HOME/.config/systemd/user"
AUTOSTART_DIR="$HOME/.config/autostart"
DESKTOP_FILE="$AUTOSTART_DIR/kdictate-cosmic.desktop"
SERVICE_FILE="$SERVICE_DIR/kdictate.service"
mkdir -p "$APP" "$BIN" "$SERVICE_DIR" "$AUTOSTART_DIR"
exec > >(tee -a "$LOG") 2>&1
echo "Verbatim installer"
echo "Target app dir: $APP"
echo "Install log: $LOG"
echo
rm -f "$HOME/scan-whisper-dictation.sh"
if [ "${XDG_SESSION_TYPE:-}" != "wayland" ]; then
echo "Notice: XDG_SESSION_TYPE=${XDG_SESSION_TYPE:-unknown}. This package is built for COSMIC on Wayland."
echo "It can still install, but test it inside your COSMIC Wayland session."
fi
if ! command -v sudo >/dev/null 2>&1; then
echo "sudo is required for OS packages and input-device access setup." >&2
exit 1
fi
sudo -v
# Keep source builds from saturating the machine.
# VERBATIM_BUILD_CPU_PERCENT=50 means use about 50% of logical CPU cores.
# Example: 16 threads -> 8 build jobs.
VERBATIM_BUILD_CPU_PERCENT="${VERBATIM_BUILD_CPU_PERCENT:-50}"
CPU_THREADS="$(nproc 2>/dev/null || echo 1)"
BUILD_JOBS="$(( CPU_THREADS * VERBATIM_BUILD_CPU_PERCENT / 100 ))"
if [ "$BUILD_JOBS" -lt 1 ]; then
BUILD_JOBS=1
fi
echo "Build throttle: ${BUILD_JOBS}/${CPU_THREADS} parallel jobs (~${VERBATIM_BUILD_CPU_PERCENT}% CPU target)"
export CMAKE_BUILD_PARALLEL_LEVEL="$BUILD_JOBS"
export MAKEFLAGS="-j${BUILD_JOBS}"
export NINJAFLAGS="-j${BUILD_JOBS}"
run_build() {
local cpu_last="$((BUILD_JOBS - 1))"
if command -v taskset >/dev/null 2>&1; then
if command -v ionice >/dev/null 2>&1; then
taskset -c "0-${cpu_last}" ionice -c 3 nice -n 10 "$@"
else
taskset -c "0-${cpu_last}" nice -n 10 "$@"
fi
else
if command -v ionice >/dev/null 2>&1; then
ionice -c 3 nice -n 10 "$@"
else
nice -n 10 "$@"
fi
fi
}
echo
echo "Detecting GPU backend..."
GPU_BACKEND="cpu"
GPU_NAME="unknown"
if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; then
GPU_BACKEND="nvidia"
GPU_NAME="$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | head -n1 || true)"
elif command -v vulkaninfo >/dev/null 2>&1; then
GPU_LINE="$(vulkaninfo --summary 2>/dev/null | grep -m1 'deviceName' || true)"
if [ -n "$GPU_LINE" ]; then
GPU_BACKEND="vulkan"
GPU_NAME="$(printf '%s\n' "$GPU_LINE" | sed 's/.*= *//')"
fi
else
# vulkan-tools will be installed below; after apt install we check again.
GPU_BACKEND="maybe-vulkan"
fi
echo "Detected GPU path: $GPU_BACKEND (${GPU_NAME:-unknown})"
echo
echo "Choose Whisper model:"
echo " 1) Speed base.en ~142 MiB disk, ~388 MB memory"
echo " 2) Balanced small.en ~466 MiB disk, ~852 MB memory [default]"
echo " 3) Quality large-v3 ~2.9 GiB disk, ~3.9 GB memory"
MODEL_CHOICE="${VERBATIM_MODEL_CHOICE:-}"
if [ -z "$MODEL_CHOICE" ]; then
if [ -r /dev/tty ] && [ -w /dev/tty ]; then
printf "Selection [2]: " > /dev/tty
read -r MODEL_CHOICE < /dev/tty || true
else
echo "No interactive terminal detected; using Balanced [2]."
MODEL_CHOICE="2"
fi
fi
MODEL_CHOICE="${MODEL_CHOICE:-2}"
case "$MODEL_CHOICE" in
1|speed|Speed|SPEED)
KDICTATE_MODEL="base.en"
KDICTATE_PROFILE="speed"
;;
3|quality|Quality|QUALITY)
KDICTATE_MODEL="large-v3"
KDICTATE_PROFILE="quality"
;;
2|balanced|Balanced|BALANCED|"")
KDICTATE_MODEL="small.en"
KDICTATE_PROFILE="balanced"
;;
*)
echo "Unknown model selection '$MODEL_CHOICE'; using Balanced [2]."
KDICTATE_MODEL="small.en"
KDICTATE_PROFILE="balanced"
;;
esac
echo "Selected: $KDICTATE_PROFILE ($KDICTATE_MODEL)"
echo
if ! grep -R "^[^#].* universe" /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources >/dev/null 2>&1; then
echo "Enabling Ubuntu universe repository for Vulkan/SPIR-V packages..."
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y universe || true
fi
echo "Installing OS packages..."
sudo apt-get update
sudo apt-get install -y \
acl \
build-essential \
libc6-dev \
curl \
ffmpeg \
git \
glslc \
spirv-headers \
spirv-tools \
vulkan-tools \
libvulkan1 \
libvulkan-dev \
gir1.2-atspi-2.0 \
gir1.2-gtk-4.0 \
libasound2-dev \
libgtk-4-1 \
libgtk-4-dev \
libportaudio2 \
libsndfile1 \
pkg-config \
valac \
portaudio19-dev \
pulseaudio-utils \
python3-cairo \
python3-dev \
python3-gi \
python3-gi-cairo \
python3-pip \
python3-venv \
wl-clipboard \
xdg-desktop-portal \
xdg-desktop-portal-gtk
if [ "$GPU_BACKEND" = "maybe-vulkan" ] && command -v vulkaninfo >/dev/null 2>&1; then
GPU_LINE="$(vulkaninfo --summary 2>/dev/null | grep -m1 'deviceName' || true)"
if [ -n "$GPU_LINE" ]; then
GPU_BACKEND="vulkan"
GPU_NAME="$(printf '%s\n' "$GPU_LINE" | sed 's/.*= *//')"
else
GPU_BACKEND="cpu"
fi
fi
# gtk4-layer-shell makes the overlay behave like a Wayland shell surface. On
# current Pop/COSMIC builds it may already be present or available as a package;
# if not, build the small upstream library from source.
if ! ldconfig -p 2>/dev/null | grep -q 'libgtk4-layer-shell.so'; then
echo "Installing gtk4-layer-shell package if available..."
if apt-cache show libgtk4-layer-shell0 >/dev/null 2>&1; then
sudo apt-get install -y libgtk4-layer-shell0 gir1.2-gtk4layershell-1.0 || true
fi
fi
if ! ldconfig -p 2>/dev/null | grep -q 'libgtk4-layer-shell.so'; then
echo "Building gtk4-layer-shell from source..."
sudo apt-get install -y \
meson \
ninja-build \
gobject-introspection \
libgirepository1.0-dev \
libwayland-dev \
wayland-protocols \
libc6-dev
# Some restored/custom systems can have build-essential installed while the
# libc development headers are missing or damaged. sys/cdefs.h comes from
# libc6-dev, so reinstall it before compiling optional layer-shell support.
sudo apt-get install -y --reinstall libc6-dev || true
TMP="$(mktemp -d)"
git clone --depth=1 https://github.com/wmww/gtk4-layer-shell.git "$TMP/gtk4-layer-shell"
if meson setup "$TMP/gtk4-layer-shell/build" "$TMP/gtk4-layer-shell" --prefix=/usr --buildtype=release \
&& run_build ninja -C "$TMP/gtk4-layer-shell/build" -j"$BUILD_JOBS" \
&& sudo ninja -C "$TMP/gtk4-layer-shell/build" install; then
sudo ldconfig
echo "gtk4-layer-shell installed."
else
echo
echo "Warning: gtk4-layer-shell could not be built on this system."
echo "Verbatim will continue with the normal GTK Wayland window fallback."
echo "The overlay may be positioned less perfectly, but dictation can still work."
echo
fi
rm -rf "$TMP"
fi
echo
echo "Configuring transcription backend..."
KDICTATE_BACKEND="faster-whisper"
KDICTATE_DEVICE="cuda"
KDICTATE_COMPUTE_TYPE="float16"
KDICTATE_WHISPER_CPP_BIN=""
KDICTATE_WHISPER_CPP_MODEL=""
if [ "$GPU_BACKEND" = "nvidia" ]; then
echo "Using NVIDIA faster-whisper CUDA backend."
else
echo "Using whisper.cpp backend for ${GPU_BACKEND}."
KDICTATE_BACKEND="whisper.cpp"
KDICTATE_DEVICE="cpu"
KDICTATE_COMPUTE_TYPE="int8"
sudo apt-get install -y cmake ninja-build glslc spirv-headers spirv-tools
WHISPER_CPP_DIR="$APP/whisper.cpp"
if [ ! -d "$WHISPER_CPP_DIR/.git" ]; then
rm -rf "$WHISPER_CPP_DIR"
git clone --depth=1 https://github.com/ggml-org/whisper.cpp.git "$WHISPER_CPP_DIR"
else
git -C "$WHISPER_CPP_DIR" pull --ff-only || true
fi
BUILD_DIR="$WHISPER_CPP_DIR/build"
if [ "$GPU_BACKEND" = "vulkan" ]; then
echo "Building whisper.cpp with Vulkan."
if cmake -S "$WHISPER_CPP_DIR" -B "$BUILD_DIR" -G Ninja \
-DGGML_VULKAN=ON \
-DCMAKE_BUILD_TYPE=Release \
&& run_build cmake --build "$BUILD_DIR" -j"$BUILD_JOBS"; then
echo "whisper.cpp Vulkan build complete."
else
echo
echo "Warning: whisper.cpp Vulkan build failed on this system."
echo "Falling back to CPU whisper.cpp build so installation can still complete."
echo "GPU acceleration can be retried later after Vulkan/SPIR-V packages are corrected."
echo
GPU_BACKEND="cpu"
rm -rf "$BUILD_DIR"
cmake -S "$WHISPER_CPP_DIR" -B "$BUILD_DIR" -G Ninja \
-DCMAKE_BUILD_TYPE=Release
run_build cmake --build "$BUILD_DIR" -j"$BUILD_JOBS"
fi
else
echo "Building whisper.cpp CPU fallback."
cmake -S "$WHISPER_CPP_DIR" -B "$BUILD_DIR" -G Ninja \
-DCMAKE_BUILD_TYPE=Release
run_build cmake --build "$BUILD_DIR" -j"$BUILD_JOBS"
fi
mkdir -p "$APP/models"
if [ ! -f "$APP/models/ggml-$KDICTATE_MODEL.bin" ]; then
"$WHISPER_CPP_DIR/models/download-ggml-model.sh" "$KDICTATE_MODEL" "$APP/models"
fi
KDICTATE_WHISPER_CPP_BIN="$WHISPER_CPP_DIR/build/bin/whisper-cli"
KDICTATE_WHISPER_CPP_MODEL="$APP/models/ggml-$KDICTATE_MODEL.bin"
fi
mkdir -p "$APP"
cat > "$APP/config.env" <<CONFIG
KDICTATE_BACKEND=$KDICTATE_BACKEND
KDICTATE_MODEL=$KDICTATE_MODEL
KDICTATE_PROFILE=$KDICTATE_PROFILE
KDICTATE_DEVICE=$KDICTATE_DEVICE
KDICTATE_COMPUTE_TYPE=$KDICTATE_COMPUTE_TYPE
KDICTATE_WHISPER_CPP_BIN=$KDICTATE_WHISPER_CPP_BIN
KDICTATE_WHISPER_CPP_MODEL=$KDICTATE_WHISPER_CPP_MODEL
KDICTATE_MIC_DEVICE=
KDICTATE_WIVRN_AUTO_AUDIO=1
KDICTATE_WIVRN_PAUSE_EASYEFFECTS=1
KDICTATE_REALTIME_TRANSCRIPTION=1
KDICTATE_REALTIME_SILENCE_TO_FINISH_SECONDS=2.85
CONFIG
echo "Backend config written to $APP/config.env"
cat "$APP/config.env"
echo
echo "Copying Verbatim files..."
rm -rf "$APP/app" "$APP/scripts" "$APP/systemd" "$APP/docs"
mkdir -p "$APP"
cp -a "$ROOT/app" "$APP/app"
cp -a "$ROOT/scripts" "$APP/scripts"
chmod +x "$APP/scripts/"*.sh "$APP/scripts/"*.py "$APP/scripts/verbatim-wayvr" 2>/dev/null || true
cp -a "$ROOT/systemd" "$APP/systemd"
cp "$ROOT/requirements.txt" "$APP/requirements.txt"
install -m 0755 "$ROOT/bin/kdictate" "$BIN/kdictate"
if [ -f "$ROOT/scripts/verbatim-wayvr" ]; then
install -m 0755 "$ROOT/scripts/verbatim-wayvr" "$BIN/verbatim-wayvr"
fi
# Optional repo files.
if [ -d "$ROOT/docs" ]; then
cp -a "$ROOT/docs" "$APP/docs"
else
mkdir -p "$APP/docs"
fi
if [ -f "$ROOT/README.md" ]; then
cp "$ROOT/README.md" "$APP/README.md"
fi
echo "Creating Python environment..."
/usr/bin/python3 -m venv --system-site-packages "$APP/venv"
"$APP/venv/bin/python" -m pip install --upgrade pip wheel setuptools
"$APP/venv/bin/pip" install -r "$APP/requirements.txt"
echo "Configuring local input injection and manual-typing detection..."
sudo modprobe uinput || true
echo uinput | sudo tee /etc/modules-load.d/kdictate-uinput.conf >/dev/null
sudo tee /etc/udev/rules.d/80-kdictate-uinput.rules >/dev/null <<'RULES'
KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"
KERNEL=="event*", SUBSYSTEM=="input", GROUP="input", MODE="0640"
RULES
sudo usermod -aG input "$USER" || true
sudo udevadm control --reload-rules || true
sudo udevadm trigger || true
sudo setfacl -m "u:$USER:rw" /dev/uinput 2>/dev/null || true
for dev in /dev/input/event*; do
[ -e "$dev" ] || continue
sudo setfacl -m "u:$USER:r" "$dev" 2>/dev/null || true
done
if command -v systemctl >/dev/null 2>&1; then
echo "Installing user service..."
install -m 0644 "$ROOT/systemd/kdictate.service" "$SERVICE_FILE"
systemctl --user daemon-reload || true
systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE DISPLAY DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR PATH || true
systemctl --user enable kdictate.service || true
systemctl --user start kdictate.service || true
fi
rm -f "$DESKTOP_FILE"
echo "Registering Super+V desktop shortcut..."
if [ -f "$APP/scripts/register_desktop_shortcut.py" ]; then
"$APP/venv/bin/python" "$APP/scripts/register_desktop_shortcut.py" "$HOME/.local/bin/kdictate toggle" || true
else
"$APP/venv/bin/python" "$APP/scripts/register_cosmic_shortcut.py" "$HOME/.local/bin/kdictate toggle" || true
fi
echo "Installing WayVR integration if possible..."
if [ -f "$APP/scripts/install_wayvr_integration.sh" ]; then
chmod +x "$APP/scripts/install_wayvr_integration.sh" || true
if command -v wayvr >/dev/null 2>&1 || command -v wayvrctl >/dev/null 2>&1 || pgrep -f 'WayVR.AppImage|/wayvr|wayvr' >/dev/null 2>&1 || [ -d "$HOME/.config/wayvr" ]; then
bash "$APP/scripts/install_wayvr_integration.sh" || true
else
echo "WayVR not detected. Skipping WayVR watch/keyboard integration."
echo "After installing or launching WayVR once, run:"
echo " bash $APP/scripts/install_wayvr_integration.sh"
fi
else
echo "WayVR integration script missing from installed app files."
fi
wait_for_daemon() {
local label="$1"
local deadline=$((SECONDS + 25))
while [ "$SECONDS" -lt "$deadline" ]; do
if "$BIN/kdictate" status >/dev/null 2>&1; then
echo "Daemon is running ($label)."
return 0
fi
sleep 0.5
done
return 1
}
echo "Restarting daemon..."
# Ask a running daemon to exit.
"$BIN/kdictate" quit >/dev/null 2>&1 || true
sleep 0.5
# Stop systemd service if present.
if command -v systemctl >/dev/null 2>&1; then
systemctl --user stop kdictate.service >/dev/null 2>&1 || true
fi
# Kill legacy/stray daemons from older installer versions.
pkill -f "$APP/app/kdictate.py daemon" >/dev/null 2>&1 || true
pkill -f '/kdictate-cosmic/app/kdictate.py daemon' >/dev/null 2>&1 || true
# Remove stale runtime files after old daemons are gone.
rm -f "${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/kdictate.sock"
rm -f "${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/kdictate.daemon.lock"
sleep 0.5
if command -v systemctl >/dev/null 2>&1; then
systemctl --user daemon-reload || true
systemctl --user import-environment \
WAYLAND_DISPLAY \
XDG_CURRENT_DESKTOP \
XDG_SESSION_TYPE \
DISPLAY \
DBUS_SESSION_BUS_ADDRESS \
XDG_RUNTIME_DIR \
PATH || true
systemctl --user enable kdictate.service >/dev/null 2>&1 || true
systemctl --user start kdictate.service || true
fi
if ! wait_for_daemon "systemd user service"; then
echo "Systemd user service did not come up; trying direct user daemon fallback..."
nohup "$BIN/kdictate" daemon >> "$APP/kdictate.log" 2>&1 &
sleep 1
if ! wait_for_daemon "direct fallback"; then
echo
echo "ERROR: Verbatim installed, but the daemon did not start."
echo
echo "Run these commands and include the output in a bug report:"
echo " kdictate status"
echo " systemctl --user status kdictate.service --no-pager -l"
echo " journalctl --user -u kdictate.service -n 120 --no-pager"
echo " tail -160 $APP/kdictate.log"
echo
exit 1
fi
fi
echo "Running doctor..."
"$BIN/kdictate" doctor || true
echo
echo "Warming Whisper $KDICTATE_MODEL with backend $KDICTATE_BACKEND."
if ! "$BIN/kdictate" warmup; then
echo
echo "Warning: warmup failed, but the daemon is running."
echo "The first dictation may take longer while the backend initializes."
fi
echo
echo "Verifying manual launch..."
if "$BIN/kdictate" start >/dev/null 2>&1; then
echo "Manual launch test: ok"
"$BIN/kdictate" cancel >/dev/null 2>&1 || true
else
echo
echo "Warning: daemon is running, but manual launch did not return ok."
echo "Check logs: $APP/kdictate.log"
fi
echo
echo "Install complete."
echo "Use: press Super+V in a text field, speak, then pause."
echo "Manual test command: kdictate start"
echo "Status command: kdictate status"
echo "Logs: $APP/kdictate.log"
echo
echo "If Super+V does not work immediately, run:"
echo " kdictate start"
echo
echo "If kdictate start works but Super+V does not, COSMIC accepted the shortcut file but has not activated it yet."
echo "Log out and back in once, or open COSMIC Settings > Input devices > Keyboard > Keyboard shortcuts and confirm Super+V."
echo
echo "Important: if doctor reports /dev/uinput or /dev/input permission problems, log out and back in once."
echo "That refreshes the new input group membership."