Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ omacast toggle | show | hide
omacast run <commandId> # Phase 1+
omacast call <method> [json] # any backend method, e.g. omacast call system.info
omacast doctor
omacast setup hyprland [--yes] # asks, then writes ~/.config/hypr/omacast.lua (Alt+Space) and requires it from hyprland.lua
omacast setup hyprland [--yes] # asks, then writes ~/.config/hypr/omacast.lua (Super+Space + Omarchy menus) and requires it from hyprland.lua

qs log -n -p "$OMARCHY_PATH/shell" -t 50 # shell log; our lines start with [omacast]
```
Expand All @@ -101,8 +101,8 @@ qs log -n -p "$OMARCHY_PATH/shell" -t 50 # shell log; our lines start with [o

Check each of these on the machine instead of assuming it; Omarchy changes often.

- **Hyprland config is Lua** (Hyprland 0.56). `~/.config/hypr/hyprland.lua` `require`s `default.hypr.omarchy` and the user's `hypr.bindings` etc. Bindings use `o.bind("ALT + SPACE", "desc", dispatcher)`. `omacast setup hyprland` writes only `~/.config/hypr/omacast.lua` and appends one `require("hypr.omacast")`. Never edit Omarchy's files.
- **Hotkey.** Super+Space is the Omarchy menu and Super+Alt+Space is the dock's app grid. omacast defaults to **Alt+Space** through `hl.dsp.global("omacast:toggle")`, so the plugin's GlobalShortcut fires with no process spawn. Users can change their binding in `omacast.lua`; never force a Super+Space swap.
- **Hyprland config is Lua** (Hyprland 0.56). `~/.config/hypr/hyprland.lua` `require`s `default.hypr.omarchy` and the user's `hypr.bindings` etc. Bindings use `o.rebind("SUPER + SPACE", "desc", dispatcher)` to replace defaults. `omacast setup hyprland` writes only `~/.config/hypr/omacast.lua` and appends one `require("hypr.omacast")`. Never edit Omarchy's files.
- **Hotkey.** Super+Space is oma-cast's unified launcher. Setup also routes Omarchy's default app-grid and menu keybindings to oma-cast; its emoji and theme shortcuts open the dedicated oma-cast views. The launcher exposes the full searchable Omarchy menu, and Ctrl+↵ can still open an item in Omarchy's native menu. All hotkeys dispatch through `hl.dsp.global(...)`, so no process spawns per keypress. Setup asks before replacing binds and preserves custom `omacast.lua` files.
- **IPC.** `omarchy-shell <target> <fn> args…` answers over the shell's socket (needs `socat`), falling back to `qs ipc`. Our target is `omacast`. `IpcHandler` (Quickshell.Io; 4.0.x dropped `ShellIpc`) functions must have typed params and return a string.
- **Theme.** Bind colours to `Commons.Color.menu.*` and sizes to `Style.*`. They follow `omarchy theme set` live; no theme parsing.
- **App launching.** Use `shell.appLibrary.launch(id, name)`. It goes through `uwsm-app -- gtk-launch`, sends terminal apps to `omarchy-launch-tui`, and shows Omarchy's launch OSD. The shell only provides `appLibrary` to `menu`-kind plugins.
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,24 @@ Requires Omarchy 4 (Hyprland 0.56+, `omarchy-shell`). Install it from the
```sh
omarchy plugin add https://github.com/typecraft-dev/oma-cast --enable
~/.config/omarchy/plugins/typecraft.omacast/bin/omacast install # link the omacast CLI into ~/.local/bin
omacast setup hyprland # bind Alt+Space
omacast setup hyprland # use Super+Space for apps and menus
omacast doctor # check everything is wired up
```

Press **Alt+Space**. Super+Space stays the Omarchy menu.
Press **Super+Space** to search applications and Omarchy menu actions together. The default Omarchy shortcuts
for its app grid, capture, system, background, theme, emoji, share, reminder and keybindings menus also open
oma-cast; the emoji and theme shortcuts open their dedicated oma-cast views. All Omarchy menu entries remain
searchable, and `Ctrl+↵` can still open the selected item in Omarchy's original menu.

`omacast setup hyprland` lists what it will change and asks before changing it. It writes
`~/.config/hypr/omacast.lua` and appends one `require("hypr.omacast")` line to
`~/.config/hypr/hyprland.lua`; it never edits Omarchy's own files. To use another key, edit
`omacast.lua`; setup never overwrites one that already exists. To bind it yourself instead, add
this to your Hyprland config:
`~/.config/hypr/hyprland.lua`; it never edits Omarchy's own files. It replaces the listed default menu/app
shortcuts through `o.rebind`; the setup confirmation lists these changes. On rerun it migrates the generated
Alt+Space binding, while preserving a customized `omacast.lua`. To use another key, edit `omacast.lua`. To bind
only the main launcher yourself, add this to your Hyprland config:

```lua
o.bind("ALT + SPACE", "omacast launcher", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + SPACE", "omacast launcher", hl.dsp.global("omacast:toggle"), { submap_universal = true })
-- While omacast is open it switches Hyprland to this submap, so Super+J/K reach the launcher.
hl.define_submap("omacast", function()
hl.bind("SUPER + F24", hl.dsp.no_op()) -- a submap needs one bind to exist
Expand Down Expand Up @@ -215,7 +219,7 @@ monitor-input-cycle "$1" && echo "Switching display"

| Key | Does |
|---|---|
| `Alt+Space` | Open or close omacast |
| `Super+Space` | Open or close oma-cast |
| `↵` / `Ctrl+↵` / `Ctrl+Shift+↵` | Run the first, second or third action |
| `Shift+↵` | Open a new window of an app (`↵` switches to the one already open) |
| `Ctrl+K` | Open the action panel (type to filter it; each action shows its shortcut) |
Expand Down
3 changes: 2 additions & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ bin/omacast bash CLI → omarchy-shell omacast <fn> (socket), plu
How the rest of this spec maps onto it:
- **§3 IPC.** There is no wire protocol between UI and backend; both live in one QML engine. The *method surface* stays: services register `namespace.method` handlers in one registry (`core/Rpc.js`), using Raycast's names (§3.4). `call()` returns a Promise and `callSync()` returns `{ok,data|error}`. Notifications (`window.visibilityChanged`, `settings.generalSettingsChanged`) go through `subscribe()`/`emit()`. External callers use `ShellIpc` (`omacast call <method> <json>`). The NDJSON host↔backend contract and supervisor (§3.3) are **deferred to Phase 5**: only Raycast extensions need Node, and they will run as a supervised child `Process` that speaks §3.3/§9.2.
- **§4 platform.** Omarchy = Hyprland, so Phase 0 targets Hyprland only. Its config is **Lua** (`hyprland.lua`, `o.bind(...)`, `hl.dsp.global(...)`), not `.conf`.
- **Omarchy launcher default [D].** `omacast setup hyprland` binds Super+Space to oma-cast and routes Omarchy's default app-grid and menu shortcuts through its unified launcher. Menu entries remain searchable with their breadcrumbs; Ctrl+↵ can summon the native Omarchy menu for a selected entry. Emoji and theme shortcuts use oma-cast's dedicated views. Setup asks before replacing these chords and leaves customized `omacast.lua` files alone.
- **§5.1 window.** It uses Omarchy's `OverlayWindow`: a fullscreen transparent layer surface with exclusive keyboard focus, and the 750×475 card drawn inside it. Clicking outside the card counts as focus loss. The surface stays mapped between opens: hidden, it is transparent and takes no input or keyboard. It is remapped only to move to another monitor or after its output goes away.
- **§6 data.** Persisted state is one versioned JSON document per store under `$XDG_DATA_HOME/omacast/db/` (`core/Migrate.js`: numbered migrations, history, atomic writes, never overwrite an unreadable or newer file). There is **no encryption at rest** and no libsecret key: Qt's FileView has no cipher, and full-disk encryption is the Omarchy default. If a store outgrows JSON (clipboard history, file index), revisit with Qt's built-in `QtQuick.LocalStorage` (SQLite) before adding a native dependency.
- **§10 frontend.** QML instead of React, with themes from Omarchy's tokens. The 8 Raycast themes (§10.4) become optional palettes over the same tokens.
Expand Down Expand Up @@ -768,7 +769,7 @@ Repo layout [D]:

### Phase 0: Skeleton and IPC (Quickshell build, §2.0) [D]
- Omarchy shell plugin `typecraft.omacast` (`plugin/`, kind `menu` so the shell hands it the shared app library, `keepLoaded`). `bin/omacast install` links it into `~/.config/omarchy/plugins/` and enables it.
- Launcher surface (750×475, 66 header, 42 footer) on the active Omarchy theme. It starts hidden and is toggled by `omacast toggle`, `omarchy-shell omacast toggle` or the global shortcut `omacast:toggle` (`omacast setup hyprland` binds Alt+Space).
- Launcher surface (750×475, 66 header, 42 footer) on the active Omarchy theme. It starts hidden and is toggled by `omacast toggle`, `omarchy-shell omacast toggle` or the global shortcut `omacast:toggle` (`omacast setup hyprland` binds Super+Space and routes the default Omarchy menu/app-grid shortcuts through the launcher).
- In-process backend: method registry with Raycast names, `system.healthPing`, `system.healthDatabase`, `system.info`, `system.getPaths`, `settings.getGeneralSettings` / `updateGeneralSettings`, and notifications. The footer shows a live `system.healthPing` round trip.
- XDG paths (§6.3), `config.json` (hot reload), logging to the shell log, and versioned JSON stores with a migrations framework.
- **Accept:** `omacast toggle` shows and hides in under 100 ms warm, measured from the CLI call to Hyprland's `openlayer`/`closelayer` event (`tests/smoke.sh`). A backend error or an unreadable store never takes the launcher down: calls answer `{ok:false,error}`, and the store goes read-only without overwriting the file, then recovers when the file is fixed. `node --test tests/` covers the registry, paths, migrations and logging.
Expand Down
79 changes: 61 additions & 18 deletions bin/omacast
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Setup
install Enable the plugin and link this CLI into ~/.local/bin
(a development checkout is also linked into omarchy-shell)
uninstall Disable and remove the plugin, offering to remove the hotkey
setup hyprland [--yes] Bind Alt+Space to the launcher in ~/.config/hypr/omacast.lua
setup hyprland [--yes] Bind Super+Space and Omarchy menu shortcuts to oma-cast
build-search Build the optional flea-search helper (needs Rust/cargo)
doctor Check that the pieces are in place

Expand Down Expand Up @@ -219,24 +219,23 @@ cmd_setup_hyprland() {
local main="$hypr_dir/hyprland.lua" file="$hypr_dir/omacast.lua" legacy="$hypr_dir/$LEGACY_NAME.lua"
[[ -f $main ]] || die "no $main; this setup targets Lua-configured Hyprland (hyprctl version: $(hyprctl version 2>/dev/null | head -1))"

local conflicts
conflicts=$(grep -rnE '"ALT \+ SPACE"|ALT, ?SPACE' "$hypr_dir" "${OMARCHY_PATH:-/usr/share/omarchy}/default/hypr" 2>/dev/null |
grep -vF -e "$file:" -e "$legacy:" | grep -vE '^\S+:[0-9]+:\s*(--|#)')
if [[ -n $conflicts ]]; then
echo "Alt+Space is already bound:" >&2
echo "$conflicts" >&2
die "unbind it first, or write $file yourself with another key"
fi

local legacy_require=0 needs_require=1 plan=()
grep -qE '^\s*require\("hypr\.oma-cast"\)' "$main" && legacy_require=1
grep -qE '^\s*require\("hypr\.omacast"\)' "$main" && needs_require=0
if [[ -f $file ]]; then
plan+=("keep your existing $file")
if grep -Eq '^o\.bind\("ALT \+ SPACE", "omacast launcher", hl\.dsp\.global\("omacast:toggle"\)(, [{] submap_universal = true [}])?\)$' "$file"; then
plan+=("change the generated launcher binding from Alt+Space to Super+Space")
plan+=("route Omarchy menu and app-grid shortcuts through oma-cast")
else
plan+=("keep your existing $file")
fi
elif [[ -f $legacy ]]; then
plan+=("move $legacy to $file, renaming oma-cast:toggle to omacast:toggle")
plan+=("move $legacy to $file and migrate its generated launcher/menu bindings")
else
plan+=("write $file, binding Alt+Space to omacast:toggle")
plan+=("write $file, binding Super+Space and Omarchy menu shortcuts to oma-cast")
fi
if [[ ! -f $file || -f $legacy ]] || grep -Eq '^o\.bind\("ALT \+ SPACE", "omacast launcher"' "$file"; then
plan+=("replace any existing binds on those menu/app chords, including custom binds on the same keys")
fi
if (( legacy_require )); then
plan+=("replace require(\"hypr.oma-cast\") with require(\"hypr.omacast\") in $main")
Expand All @@ -254,12 +253,30 @@ cmd_setup_hyprland() {
cp -p -- "$legacy" "$file" &&
sed -i 's/oma-cast/omacast/g; s/rerunning setup overwrites it/rerunning setup keeps it/' "$file" &&
rm -- "$legacy" && echo "moved $legacy to $file"
elif [[ ! -f $file ]]; then
fi

if [[ ! -f $file ]]; then
cat >"$file" <<'LUA'
-- Written by `omacast setup hyprland`. Safe to edit; rerunning setup keeps it.
-- Alt+Space reaches the plugin's global shortcut directly, so no process
-- starts per keypress. Omarchy's own menu stays on Super+Space.
o.bind("ALT + SPACE", "omacast launcher", hl.dsp.global("omacast:toggle"), { submap_universal = true })
-- Super+Space opens the unified launcher. Omarchy's menu actions and app grid
-- are also routed here, so apps and every Omarchy menu can be searched together.
o.rebind("SUPER + SPACE", "omacast launcher", hl.dsp.global("omacast:toggle"), { submap_universal = true })
-- Keep the dedicated Omarchy menu keys useful through oma-cast's unified search.
o.rebind("SUPER + ALT + SPACE", "oma-cast apps and menus", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + C", "oma-cast capture menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + O", "oma-cast toggle menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + H", "oma-cast hardware menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + SHIFT + code:201", "oma-cast Omarchy menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + ESCAPE", "oma-cast system menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + K", "oma-cast keybindings menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Super+K closes the launcher

The new binding uses submap_universal = true, so Hyprland still takes Super+K while the launcher is open. It calls toggle() and closes the launcher instead of letting the user move up through results or popup lists. Remove submap_universal from this binding and its migration copy at line 307 so Super+K reaches the launcher while open.

Prompt To Fix With AI
This is a comment left during a code review.
Path: bin/omacast
Line: 271

Comment:
**Super+K closes the launcher**

The new binding uses `submap_universal = true`, so Hyprland still takes Super+K while the launcher is open. It calls `toggle()` and closes the launcher instead of letting the user move up through results or popup lists. Remove `submap_universal` from this binding and its migration copy at line 307 so Super+K reaches the launcher while open.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

o.rebind("SUPER + CTRL + SPACE", "oma-cast background menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + W", "oma-cast background menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + S", "oma-cast share menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + R", "oma-cast reminder menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
-- Keep Omarchy's dedicated emoji and theme shortcuts, using oma-cast views.
o.rebind("SUPER + CTRL + E", "oma-cast emoji picker", hl.dsp.global("omacast:emoji"), { submap_universal = true })
o.rebind("SUPER + SHIFT + CTRL + SPACE", "oma-cast theme menu", hl.dsp.global("omacast:theme"), { submap_universal = true })
o.rebind("SUPER + CTRL + T", "oma-cast theme menu", hl.dsp.global("omacast:theme"), { submap_universal = true })
-- While the launcher is open, the plugin puts Hyprland in this submap so Super+J/K
-- (and every other Super key Hyprland would grab) reach omacast as arrow keys.
-- omacast's own hotkeys are submap_universal so they still work there.
Expand All @@ -273,14 +290,40 @@ LUA
echo "wrote $file"
fi

# Migrate only the exact launcher binding generated by earlier oma-cast
# setups; a hand-edited binding remains the user's choice. The setup prompt
# above explicitly lists this migration and the menu shortcut overrides.
if grep -Eq '^o\.bind\("ALT \+ SPACE", "omacast launcher", hl\.dsp\.global\("omacast:toggle"\)(, [{] submap_universal = true [}])?\)$' "$file"; then
sed -i -E 's/^o\.bind\("ALT \+ SPACE", "omacast launcher", hl\.dsp\.global\("omacast:toggle"\)(, [{] submap_universal = true [}])?\)$/o.rebind("SUPER + SPACE", "omacast launcher", hl.dsp.global("omacast:toggle"), { submap_universal = true })/' "$file"
cat >>"$file" <<'LUA'

-- oma-cast unified Omarchy menu bindings (added by `omacast setup hyprland`).
o.rebind("SUPER + ALT + SPACE", "oma-cast apps and menus", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + C", "oma-cast capture menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + O", "oma-cast toggle menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + H", "oma-cast hardware menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + SHIFT + code:201", "oma-cast Omarchy menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + ESCAPE", "oma-cast system menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + K", "oma-cast keybindings menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + SPACE", "oma-cast background menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + W", "oma-cast background menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + S", "oma-cast share menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + R", "oma-cast reminder menu", hl.dsp.global("omacast:toggle"), { submap_universal = true })
o.rebind("SUPER + CTRL + E", "oma-cast emoji picker", hl.dsp.global("omacast:emoji"), { submap_universal = true })
o.rebind("SUPER + SHIFT + CTRL + SPACE", "oma-cast theme menu", hl.dsp.global("omacast:theme"), { submap_universal = true })
o.rebind("SUPER + CTRL + T", "oma-cast theme menu", hl.dsp.global("omacast:theme"), { submap_universal = true })
LUA
echo "migrated the generated Alt+Space binding and Omarchy menu shortcuts"
fi

if (( legacy_require )); then
sed -i -E 's/^(\s*)require\("hypr\.oma-cast"\)/\1require("hypr.omacast")/; s/^-- oma-cast launcher bindings$/-- omacast launcher bindings/' "$main"
echo "updated the require in $main"
elif (( needs_require )); then
printf '\nrequire("hypr.omacast")\n' >>"$main"
echo "added require(\"hypr.omacast\") to $main"
fi
hyprctl reload >/dev/null && echo "reloaded Hyprland; Alt+Space toggles omacast"
hyprctl reload >/dev/null && echo "reloaded Hyprland; Super+Space opens oma-cast and Omarchy menu shortcuts use its unified search"
}

# QML errors the shell logged for the plugin dir as it's loaded now: everything
Expand Down