|
| 1 | +cask 'handy' do |
| 2 | + version '0.7.12' |
| 3 | + |
| 4 | + name 'Handy' |
| 5 | + desc 'Open source offline speech-to-text transcription app' |
| 6 | + homepage 'https://handy.computer' |
| 7 | + |
| 8 | + livecheck do |
| 9 | + url 'https://github.com/cjpais/Handy/releases/latest' |
| 10 | + strategy :header_match |
| 11 | + end |
| 12 | + |
| 13 | + on_macos do |
| 14 | + on_arm do |
| 15 | + url "https://github.com/cjpais/Handy/releases/download/v#{version}/Handy_#{version}_aarch64.dmg" |
| 16 | + sha256 'd7acf62e4c8ca91100d0759d1b7fe5bc3d425352c2e2dfe68ca734166675622d' |
| 17 | + end |
| 18 | + |
| 19 | + on_intel do |
| 20 | + url "https://github.com/cjpais/Handy/releases/download/v#{version}/Handy_#{version}_x64.dmg" |
| 21 | + sha256 'dc3628cf83405cb25cadcd1f091581f50603fdc7b7adbe2eb911a3a72196e0a1' |
| 22 | + end |
| 23 | + |
| 24 | + app 'Handy.app' |
| 25 | + |
| 26 | + zap trash: [ |
| 27 | + '~/Library/Application Support/computer.handy', |
| 28 | + '~/Library/Caches/computer.handy', |
| 29 | + '~/Library/Preferences/computer.handy.plist' |
| 30 | + ] |
| 31 | + |
| 32 | + caveats <<~CAVEATS |
| 33 | + Handy registers its own global keyboard shortcut for push-to-talk. |
| 34 | + Configure the shortcut in the Handy app preferences after first launch. |
| 35 | + CAVEATS |
| 36 | + end |
| 37 | + |
| 38 | + on_linux do |
| 39 | + on_arm do |
| 40 | + url "https://github.com/cjpais/Handy/releases/download/v#{version}/Handy_#{version}_aarch64.AppImage" |
| 41 | + sha256 '2e7be5b88aab3f900612fc83d9d451cde6ad9f52c632bba80aab8e5493efee72' |
| 42 | + |
| 43 | + binary "Handy_#{version}_aarch64.AppImage", target: 'handy' |
| 44 | + end |
| 45 | + |
| 46 | + on_intel do |
| 47 | + url "https://github.com/cjpais/Handy/releases/download/v#{version}/Handy_#{version}_amd64.AppImage" |
| 48 | + sha256 '421f363ef644ad65a1011b3b673a061659505cab05eb71941aa1b9b5a4fe915f' |
| 49 | + |
| 50 | + binary "Handy_#{version}_amd64.AppImage", target: 'handy' |
| 51 | + end |
| 52 | + |
| 53 | + caveats <<~CAVEATS |
| 54 | + To set up a GNOME keyboard shortcut for Handy (Super+Z): |
| 55 | +
|
| 56 | + SHORTCUT_PATH="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/handy/" |
| 57 | + SCHEMA="org.gnome.settings-daemon.plugins.media-keys" |
| 58 | + BINDING_SCHEMA="org.gnome.settings-daemon.plugins.media-keys.custom-keybinding" |
| 59 | + CURRENT=$(gsettings get "$SCHEMA" custom-keybindings) |
| 60 | + [ "$CURRENT" = "@as []" ] && NEW="['$SHORTCUT_PATH']" || NEW=$(echo "$CURRENT" | sed "s|]$|, '$SHORTCUT_PATH']|") |
| 61 | + gsettings set "$SCHEMA" custom-keybindings "$NEW" |
| 62 | + gsettings set "$BINDING_SCHEMA:$SHORTCUT_PATH" name "Toggle Handy Transcription" |
| 63 | + gsettings set "$BINDING_SCHEMA:$SHORTCUT_PATH" command "#{HOMEBREW_PREFIX}/bin/handy --toggle-transcription" |
| 64 | + gsettings set "$BINDING_SCHEMA:$SHORTCUT_PATH" binding "<Super>z" |
| 65 | +
|
| 66 | + For Wayland text input, install wtype or dotool: |
| 67 | + sudo apt install wtype |
| 68 | +
|
| 69 | + For X11 text input, install xdotool: |
| 70 | + sudo apt install xdotool |
| 71 | + CAVEATS |
| 72 | + end |
| 73 | +end |
0 commit comments