* Add selectable dictation backends * Move dictation migration after repository priority update * Extract backend-specific dictation installers * Keep dictation installer dispatcher executable * Call dictation backend installers directly * Drop legacy Superwhisper migration and runtime cleanup * Separate dictation defaults from generic recording protocol * Add backend-specific dictation removers * Preserve existing Voxtype selection during upgrade * Make dictation backend selection safe and retryable * Show the dictation indicator only for selected Voxtype * Allow switching away from stopped Superwhisper * Remove the built-in bar dictation indicator * Store default dictation selection under defaults * Rename dictation backend selector to use * Move dictation removers into their own menu category
34 lines
932 B
Bash
Executable File
34 lines
932 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:hidden=true
|
|
# omarchy:summary=Save a configured dictation backend after stopping the previous backend
|
|
# omarchy:args=<backend>
|
|
|
|
set -e
|
|
|
|
if (($# != 1)) || [[ ! $1 =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
echo "Usage: omarchy-dictation-use <backend>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
config="${XDG_CONFIG_HOME:-$HOME/.config}/omarchy/defaults/dictation"
|
|
mkdir -p "${config%/*}"
|
|
exec 9> "$config.lock"
|
|
if ! flock -w 5 9; then
|
|
echo "Dictation is busy; try again." >&2
|
|
exit 1
|
|
fi
|
|
|
|
previous=$(omarchy-default-dictation 2>/dev/null) || previous=""
|
|
if [[ -n $previous && $previous != "$1" ]] && omarchy-cmd-present "omarchy-dictation-$previous"; then
|
|
if ! "omarchy-dictation-$previous" stop 9>&-; then
|
|
echo "Could not stop $previous; keeping the existing dictation backend." >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
temporary=$(mktemp "$config.XXXXXX")
|
|
trap 'rm -f "$temporary"' EXIT
|
|
printf '%s\n' "$1" > "$temporary"
|
|
mv -f "$temporary" "$config"
|