Fix macOS overlay launch: faster capture, no Space thrash, Raycast-safe

Drop osascript fullscreen exit and slow focus hacks; capture immediately
and show a high-level CanJoinAllSpaces overlay. Avoid mutually exclusive
NSWindowCollectionBehavior flags that aborted under Raycast, harden
activation for non-UI script hosts, and document installing to PATH.
This commit is contained in:
lakshit verma 2026-07-20 13:08:38 +05:30
parent b2bf9b66ad
commit 0d6dcaa0c7
No known key found for this signature in database
GPG key ID: EB498AFC60A7A01A
5 changed files with 843 additions and 151 deletions

1
Cargo.lock generated
View file

@ -993,6 +993,7 @@ version = "0.1.0"
dependencies = [
"cocoa",
"image",
"libc",
"objc",
"pixels",
"screenshots",

View file

@ -12,4 +12,10 @@ image = "0.24"
[target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.25"
objc = "0.2"
libc = "0.2"
# The old `objc` crate checks `feature = "cargo-clippy"` inside macros.
# Declare it so rustc's unexpected_cfgs lint stays quiet.
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("cargo-clippy"))'] }

View file

@ -45,8 +45,28 @@ The following Rust crates are used:
## Running
```bash
$ cargo build --release
$ cargo run --release
```
The application will immediately capture your screen and display it in fullscreen mode. Use your trackpad or mouse to zoom and pan around the screenshot.
### Install to PATH (needed for Raycast)
Raycast scripts usually resolve `moomer` via `~/.local/bin`. After every rebuild:
```bash
$ cargo build --release
$ cp -f target/release/moomer ~/.local/bin/moomer
```
### Raycast Script Command
Import or paste `scripts/moomer-raycast.sh` as a Raycast Script Command:
- **Mode:** Silent
- Runs `~/.local/bin/moomer` detached (`nohup`) so Raycast doesnt kill the overlay
- Logs: `/tmp/moomer.log` and `/tmp/moomer.raycast.out`
If Raycast “does nothing”, check those logs — a stale `~/.local/bin/moomer` was a common cause (it crashed on launch).

23
scripts/moomer-raycast.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Moomer
# @raycast.mode silent
# @raycast.packageName Moomer
# @raycast.icon 🔍
# @raycast.description Screenshot + zoom overlay (boomer-style)
#
# Keep the installed binary in sync after builds:
# cp -f target/release/moomer ~/.local/bin/moomer
set -euo pipefail
BIN="${MOOMER_BIN:-$HOME/.local/bin/moomer}"
if [[ ! -x "$BIN" ]]; then
BIN="$(cd "$(dirname "$0")/.." && pwd)/target/release/moomer"
fi
# Detach from Raycast so the GUI keeps running after the script exits.
nohup "$BIN" >>/tmp/moomer.raycast.out 2>&1 &
disown || true
exit 0

File diff suppressed because it is too large Load diff