Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
#!/bin/bash
# Post-install script for OpenWhispr (deb/rpm)
# Sets up chrome-sandbox permissions and ydotool daemon prerequisites.
# Best-effort: nothing here may fail the package install.
set -uo pipefail
# 0. Set SUID bit on chrome-sandbox (required by Electron for Linux sandboxing)
# Find it wherever dpkg placed the package files, rather than hardcoding /opt/...
CHROME_SANDBOX=$(dpkg -L open-whispr 2>/dev/null | grep chrome-sandbox || echo "")
if [ -z "$CHROME_SANDBOX" ]; then
# Fallback: conventional electron-builder install path
CHROME_SANDBOX="/opt/OpenWhispr/chrome-sandbox"
fi
if [ -f "$CHROME_SANDBOX" ]; then
chown root:root "$CHROME_SANDBOX" 2>/dev/null || true
chmod 4755 "$CHROME_SANDBOX" 2>/dev/null || true
fi
UDEV_RULE='KERNEL=="uinput", GROUP="input", MODE="0660", TAG+="uaccess"'
UDEV_RULE_PATH="/etc/udev/rules.d/70-uinput.rules"
SERVICE_PATH="/usr/lib/systemd/user/ydotoold.service"
# Detect the real user (not root) who triggered the install.
# No SUDO_USER and no tty (GUI installers, D-Bus backed ones like Aptkit) is fine:
# the user-specific steps below are simply skipped.
REAL_USER="${SUDO_USER:-}"
if [ -z "$REAL_USER" ] || [ "$REAL_USER" = "root" ]; then
REAL_USER=$(logname 2>/dev/null || echo "")
fi
if [ "$REAL_USER" = "root" ]; then
REAL_USER=""
fi
# 1. udev rule for /dev/uinput — only where udev actually exists (skipped in
# containers, chroots and minimal systems, where the rule is useless anyway)
if [ -d /etc/udev/rules.d ]; then
if [ ! -f "$UDEV_RULE_PATH" ] || ! grep -q uinput "$UDEV_RULE_PATH" 2>/dev/null; then
echo "$UDEV_RULE" > "$UDEV_RULE_PATH" 2>/dev/null || true
udevadm control --reload-rules 2>/dev/null || true
udevadm trigger /dev/uinput 2>/dev/null || true
fi
fi
# 2. Add user to input group
if [ -n "$REAL_USER" ]; then
if ! id -nG "$REAL_USER" 2>/dev/null | grep -qw input; then
usermod -aG input "$REAL_USER" 2>/dev/null || true
fi
fi
# 3. systemd user service for ydotoold
# Skip if a service already exists (e.g. Fedora ships one with the ydotool package)
# or if systemd is not present on this system at all.
if [ -d /usr/lib/systemd ] && [ ! -f "$SERVICE_PATH" ] && [ ! -f "/usr/lib/systemd/user/ydotool.service" ]; then
YDOTOOLD_BIN=$(command -v ydotoold 2>/dev/null || echo "/usr/bin/ydotoold")
if [ -x "$YDOTOOLD_BIN" ] || [ -f "$YDOTOOLD_BIN" ]; then
mkdir -p "$(dirname "$SERVICE_PATH")" 2>/dev/null || true
if [ -d "$(dirname "$SERVICE_PATH")" ]; then
cat > "$SERVICE_PATH" 2>/dev/null << SERVICEEOF || true
[Unit]
Description=ydotoold - ydotool daemon
After=graphical-session.target
PartOf=graphical-session.target
[Service]
ExecStartPre=/usr/bin/sleep 2
ExecStart=$YDOTOOLD_BIN
Restart=on-failure
RestartSec=1s
[Install]
WantedBy=graphical-session.target
SERVICEEOF
fi
fi
fi
# 4. Enable the service for the installing user
if [ -n "$REAL_USER" ]; then
REAL_UID=$(id -u "$REAL_USER" 2>/dev/null || echo "")
if [ -n "$REAL_UID" ]; then
# systemctl --user requires XDG_RUNTIME_DIR
export XDG_RUNTIME_DIR="/run/user/$REAL_UID"
if [ -d "$XDG_RUNTIME_DIR" ]; then
# Determine the correct service name
SERVICE_NAME=""
if [ -f "/usr/lib/systemd/user/ydotoold.service" ]; then
SERVICE_NAME="ydotoold"
elif [ -f "/usr/lib/systemd/user/ydotool.service" ]; then
SERVICE_NAME="ydotool"
fi
if [ -n "$SERVICE_NAME" ]; then
su - "$REAL_USER" -c "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR systemctl --user daemon-reload" 2>/dev/null || true
su - "$REAL_USER" -c "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR systemctl --user enable $SERVICE_NAME" 2>/dev/null || true
fi
fi
fi
fi
exit 0