mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 10:56:10 +00:00
Give a Mac an installer, an app bundle and a menu bar icon it can see
The macOS backends were already here: CoreAudio capture through ffmpeg, pbcopy and CoreGraphics, Carbon hotkeys, the paths under ~/Library. What was missing was everything that installs them, so install.sh hands over to install-mac.sh on Darwin rather than growing a branch per line: the XDG directories, the .desktop files and the shortcut registry mean nothing there, and an application is a bundle rather than a path. The bundle carries a copy of the interpreter, because macOS files the microphone and Accessibility permissions against the process that asks, and a launcher running Homebrew's python3 would have asked as python3 and shared the grant with everything else on that interpreter. It is signed ad-hoc so a reinstall is the same application rather than two more dialogs, and it says so plainly when a brew upgrade has moved the tree it needs. uninstall.sh and update.sh follow it. The tray icon was invisible: QIcon.fromTheme wants a freedesktop icon theme and hands back a null icon without one, which in a menu bar is the whole interface gone. trayicon.py draws the three shapes as template images, so they follow the menu bar into dark mode, and the bundle's icon comes off the same glyph rather than a binary in the repository. Linux keeps its own icons; these are used only where the theme has nothing. paths.py is the fix that was never about a Mac. config.py imports ggml.py, so ggml.py could not ask it where the data goes; each worked it out for itself and only one of them knew about macOS. Settings went to ~/Library while several gigabytes of models went to ~/.local/share, which is not a place a Mac user looks and not a place uninstall.sh --purge would have deleted from. Ctrl+Space is the input-source switch there and Cmd+Space is Spotlight, so the default is Ctrl+Option+Space, and hotkey.default_combo is the one place that difference lives. The first paste asks for Accessibility with kAXTrustedCheckOptionPrompt, which is what creates the row to switch on; asking the other way opens a pane Dikte is not listed in. `dikte shortcut status` asks the running instance, since the combination is held by that process and by nothing else. Local speech to text is the one piece a Mac builds by hand. whisper.cpp publishes no macOS binary and Homebrew's is configured with WHISPER_BUILD_SERVER=OFF, so it installs whisper-cli and not the server Dikte talks to; program_path already takes a whisper-server off the PATH or out of Settings, so the answer is the one a Linux distribution gets, and the README carries the cmake line. CI grows a macOS job on 3.11 and 3.13, the only place the Carbon and CoreGraphics libraries have to be there to be opened. Written and tested on macOS 27.0 arm64. Two things are still unverified on a Mac: the paste end to end, which waits on the Accessibility toggle, and a meeting recording, which needs a loopback driver.
This commit is contained in:
@@ -55,11 +55,32 @@ tools instead:
|
||||
sudo apt install pulseaudio-utils xclip xdotool ffmpeg
|
||||
```
|
||||
|
||||
macOS has no shortcut registry for `install.sh` to install into, so the listener
|
||||
that catches the keys is the mechanism there and there is nothing to run:
|
||||
`brew install ffmpeg`, `pip install PyQt6`, then `python dikte.py`. A meeting
|
||||
needs BlackHole or Loopback, because nothing else offers what the speakers are
|
||||
playing.
|
||||
On macOS the same `./install.sh` runs and hands over to `install-mac.sh`, which
|
||||
puts down a `Dikte.app` in `~/Applications`, the `dikte` command and a
|
||||
LaunchAgent:
|
||||
|
||||
```sh
|
||||
brew install pyqt ffmpeg # pyqt brings a Python newer than Apple's 3.9 with it
|
||||
|
||||
./install.sh # or: ./install.sh "Ctrl+Option+Space" "Ctrl+Option+D"
|
||||
open -a Dikte
|
||||
```
|
||||
|
||||
The bundle is what macOS files the **Microphone** and **Accessibility**
|
||||
permissions against, and it asks for each the first time it needs one. The
|
||||
default there is `Ctrl+Option+Space`, since macOS keeps `Ctrl+Space` for the
|
||||
input-source switch, and nothing needs a logout: Dikte holds the combination
|
||||
itself while it runs. PyQt6 comes from brew rather than pip because Homebrew's
|
||||
Python refuses to be installed into, and `DIKTE_PYTHON=…/venv/bin/python
|
||||
./install.sh` points the installer at a virtualenv instead.
|
||||
|
||||
Local speech to text is the one piece that has to be built by hand there:
|
||||
whisper.cpp publishes no macOS binary and Homebrew's is configured with
|
||||
`WHISPER_BUILD_SERVER=OFF`, so it installs `whisper-cli` and not the server
|
||||
Dikte talks to. Build it (`cmake -B build -DWHISPER_BUILD_SERVER=ON
|
||||
-DGGML_METAL=ON && cmake --build build -j`) and give Settings → API the path, or
|
||||
transcribe in the cloud. A meeting needs BlackHole or Loopback
|
||||
(`brew install blackhole-2ch`); dictation does not.
|
||||
|
||||
`install.sh` adds the `dikte` command, a menu entry, an autostart entry and the
|
||||
two global shortcuts, whose keys are its two arguments. `./update.sh` pulls and
|
||||
@@ -189,8 +210,9 @@ vad.py deciding whether a recording holds speech at all
|
||||
filetranscribe.py file transcription: ffmpeg, chunking, timestamps
|
||||
overlay.py the corner indicator
|
||||
settings_ui.py settings window
|
||||
hotkey.py KDE shortcut installation and the evdev listener
|
||||
paste.py wl-clipboard and ydotool wrappers
|
||||
hotkey.py KDE shortcut installation, the evdev listener, Carbon on a Mac
|
||||
paste.py wl-clipboard and ydotool wrappers, pbcopy and CoreGraphics
|
||||
trayicon.py the tray icons, drawn where there is no icon theme
|
||||
i18n.py the string table
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user