Implements the hot-reload pipeline per docs/lua-api.md §7: the daemon
watches the user's owlry.lua and, on save, re-evaluates in a fresh
LuaContext. On success the new state hot-swaps atomically; on failure
the previous state is preserved and the user is told what broke via
BOTH the daemon log AND a desktop notification — no need to tail the
journal to discover the config is dead.
Cargo.toml:
- New optional dep `notify = "6"` gated by the `lua` feature alongside
mlua and glob. inotify backend on Linux; no platform-specific feature
flags needed.
lua/watcher.rs (new):
- ConfigWatcher::spawn(lua_path, config, pm, lua_ctx) wires a
notify::RecommendedWatcher on the parent directory (atomic-rename
saves from vim/JetBrains/etc rebind to a new inode, so watching the
file directly misses them) and spawns the event-pump thread.
- Debounce: 200ms after the first event, drain follow-ups, then reload
once. Coalesces burst saves into a single re-eval.
- reload() builds a fresh state in isolation; on Err keeps the old
Config/PM/LuaContext untouched.
- Swap order: config → ProviderManager → LuaContext. Old user-provider
Boxes inside the dropped PM retain the old Arc<Lua> until they
themselves drop, so the OLD Lua state survives the swap until the
OLD PM finishes dropping. New LuaProviders in new_pm hold the new
Arc<Lua>.
- report_reload_failure() formats the full error chain and fires a
notify_rust notification with summary/body/icon/urgency so the user
sees "config reload failed — /path/to/owlry.lua — <exact line>" the
moment a save breaks the file.
- Success path also emits a low-noise notification ("config reloaded").
lua/error.rs:
- LuaConfigError::Eval and ::Read no longer embed `{source}` in their
Display strings — error_chain() walks `.source()` already, and the
doubled rendering produced duplicated text in notifications and
logs. Comment explains why for the next reader.
server.rs:
- _lua_ctx changed from `Option<LuaContext>` to
`Arc<Mutex<Option<LuaContext>>>` so the watcher thread can atomically
replace it without taking the daemon down.
- New `_lua_watcher: Option<ConfigWatcher>` field, populated only when
loaded.lua_path is Some. Failure to spawn the watcher logs at warn
but doesn't fail Server::bind — the daemon stays usable even if
inotify is exhausted or perms are wrong.
- Mutex import feature-gated so --no-default-features stays
warning-free.
Tests: 5 new in lua::watcher::tests
- reload_swaps_in_new_config_state: change max_results in the file,
call reload() directly, verify Config got the new value.
- reload_failure_preserves_previous_state: write broken Lua, verify
Config is untouched.
- reload_replaces_user_providers_with_new_definitions: replace user
provider v1 with v2, verify a search for the v1 item returns nothing
and v2 is found (the websearch dynamic provider initially false-
positived on substring "v1 unique" via "Search: v1 unique" — locked
the test to the exact name "v1 unique item").
- event_touches_matches_only_watched_path: paths outside the watched
file are ignored.
- error_chain_renders_nested_causes: confirms chain walking works.
Live smoke (release build, isolated XDG, file edits via shell):
- v1 → save v2 → daemon log "hot-reload: applied"; :test prefix now
returns 2 v2 items.
- v2 → save broken Lua → daemon log "hot-reload: re-eval of /.../
owlry.lua failed, keeping previous config — Lua evaluation error in
/.../owlry.lua: syntax error: [string]:2: '}' expected (to close
'{' at line 1) near <eof>". Notification body shows the same
detail (file path + precise error). :test prefix still returns v2
items.
- Invalid provider id ("BadId With Spaces"): "runtime error: owlry.
provider: id 'BadId With Spaces' invalid — must be lowercase
alphanumeric with `-`/`_`". Old state preserved.
322/322 lib tests with --features full. Clippy silent across full,
--features lua, and --no-default-features.
Implements the six host helpers per docs/lua-api.md §5.1:
owlry.util.shell(cmd) -> string (stdout, trim_end)
owlry.util.shell_lines(cmd) -> table (split, no trailing empty)
owlry.util.read_file(path) -> string|nil (nil on any I/O error)
owlry.util.glob(pattern) -> table (tilde-expanded; PatternError → Lua err)
owlry.util.env(name, def?) -> string|nil
owlry.util.hostname() -> string
Cargo.toml:
- New optional dep `glob = "0.3"` gated by the `lua` feature alongside
mlua. Pure-Rust, no system Lua/C deps.
lua/util.rs:
- `build(lua) -> mlua::Result<Table>` constructs the owlry.util sub-table
with every helper registered. Stateless; no Arc<Mutex<LuaConfig>> needed.
- shell uses `sh -c`; stderr is logged at warn on non-zero exit but
stdout is still returned (don't crash user configs on missing commands).
- shell_lines drops the trailing empty element so a terminating newline
doesn't produce a phantom "" item.
- read_file extends "nil if missing" (per spec) to "nil on any I/O
failure" — saves users wrapping every read in pcall.
- glob expands a leading `~/` via `dirs::home_dir()`. `~user/`, embedded
`~`, and env-var refs are intentionally left as-is (predictable surface).
- hostname uses libc::gethostname directly (libc is already a hard dep).
lua/api.rs:
- install() now attaches `owlry.util = util::build(lua)?` to the parent
owlry table.
Tests: 17 new
- util.rs (15): shell trim, interior newlines preserved, shell_lines
split/empty cases, read_file present/missing, glob match/empty/error,
env present/missing/default, hostname non-empty, tilde expansion
positive/negative.
- runtime.rs (2): owlry.util surface exists with all 6 functions after
api::install; util helpers feed into a user provider's items()
end-to-end (hostname-as-launch-item, via LuaProvider::refresh).
Smoke (release build, isolated XDG, user provider :host_info using
hostname/shell/env): daemon loads 4 items per the user provider —
"host: cn-arch", "kernel: 7.0.5-zen1-1.1-zen", "home: /home/...",
"user: cnachtigall". 317/317 lib tests with --features full. Clippy
silent across all three feature configurations.
Adds the lua cargo feature and a stubbed crates/owlry/src/lua/ module
in preparation for Phase 3 (Lua config layer per docs/lua-api.md).
- mlua 0.11 (lua54, vendored, send, serialize) as an optional dep so
AUR clean-chroot builds don't depend on system Lua.
- New `lua` feature gates the module; included in the `full` feature
set so the AUR build ships it. Disabled by default so minimal
`cargo install` consumers don't pay for the C compile.
- Stub submodules: runtime (LuaContext), api (owlry.* surface), error
(LuaConfigError), util (owlry.util.*). Every function is a no-op
placeholder for the sub-phases that will wire them.
- pub mod lua gated behind #[cfg(feature = "lua")] in lib.rs.
cargo check passes with --no-default-features, --features lua, and
--features full. 221/221 lib tests still green. Zero clippy warnings
from the new module.
Patch release covering:
- fix(providers): dynamic providers (calc, conv, websearch, filesearch)
now appear in owlry doctor and owlry providers <id> output
- feat(aur/install-hook): proactive detection of stale owlryd references
in user-level systemd units and compositor configs
No behavioural changes beyond diagnostic visibility and upgrade-time
warnings. No config or API breakage; safe drop-in upgrade.
Cargo.toml + PKGBUILD bumped together; .SRCINFO regenerated; b2sum
will be refreshed by 'just aur-update' once the tag is pushed.
The bookmarks provider opened Firefox's places.sqlite directly via
rusqlite, which pulled libsqlite3-sys with its bundled feature to
compile sqlite3.c statically. In clean Arch chroots the bundled feature
kept slipping out of the resolved feature graph and the chroot build
failed at link time with every sqlite3_* symbol undefined. Inline
features = ["bundled"] on the optional dep didn't help; neither did
the explicit "rusqlite/bundled" feature wiring (commit 7569b2d).
Rather than fight Cargo's resolver further, defer the bookmarks
provider alongside the widgets per the same pattern (D20 -> D22).
Returns in a later 2.x release with a pure-Rust reader:
- Chromium's Bookmarks file is already JSON.
- Firefox exposes JSON backups under ~/.mozilla/firefox/<profile>/
bookmarkbackups/<dated>.jsonlz4 — needs lz4 + JSON parse, no SQLite.
Removed:
- crates/owlry/src/providers/bookmarks.rs
- bookmarks module + registration in providers/mod.rs
- bookmarks feature + rusqlite dep in Cargo.toml
- ProvidersConfig.bookmarks field (existing user configs that still
have 'bookmarks = true' silently ignore it — serde default behavior)
- :bm prefix from README's search-prefix table
- bookmarks acknowledgement in README + ROADMAP roadmap section
Cargo.lock loses rusqlite, libsqlite3-sys, fallible-iterator,
fallible-streaming-iterator, foldhash, hashlink, rsqlite-vfs,
sqlite-wasm-rs (-80 lines).
PKGBUILD: owlry-plugin-bookmarks stays in replaces= (any user who has
it installed still needs a clean upgrade), but moved from the 'folded'
comment block to the 'deferred (D20+)' block.
Docs:
- README: bookmarks removed from optional-providers list, feature
table, search-prefix table, config example. Added to upcoming
roadmap section alongside widgets.
- ROADMAP: 'Bookmarks return' subsection added next to 'Widget
providers return'.
- CLAUDE.md: provider tree updated.
- docs/RESTRUCTURE-V2.md: new decision D22 with chroot-build
rationale; task #6 plugin count 8 -> 7 -> 6.
245 tests pass with --features full (was 252; the 7 bookmarks unit
tests went with the module). Build verified locally; chroot build
should now succeed since libsqlite3-sys is no longer in the graph
at all.
Closes the v2 plugin conversion. Six providers ported from the
owlry-plugins sibling repo into the single owlry crate as feature-
gated modules. Each follows the same pattern established by systemd:
drop extern "C"/PluginItem/ProviderHandle/owlry_plugin! scaffolding,
implement Provider or DynamicProvider directly on a regular struct.
Static providers (Provider trait, populate via refresh):
- providers/bookmarks.rs — Firefox + Chromium bookmarks via rusqlite,
favicon cache preserved. dep: rusqlite (bundled), feature: bookmarks
- providers/clipboard.rs — cliphist history. feature: clipboard
- providers/emoji.rs — bundled emoji list with keyword tags.
feature: emoji
- providers/ssh.rs — ~/.ssh/config host extraction. feature: ssh
Dynamic providers (DynamicProvider trait, generate per query):
- providers/filesearch.rs — fd / mlocate shellout with extract_search_term
for ':file' and '/' triggers. feature: filesearch
- providers/websearch.rs — URL builder with DuckDuckGo/Google/custom
engines. TODO: plumb engine through constructor once Lua config lands
(Phase 3). feature: websearch
Wiring:
- Cargo.toml: 7 per-provider features + 'full' meta-feature. rusqlite
added as optional dep (only pulled in with feature 'bookmarks').
- config/mod.rs: ProvidersConfig gains 6 new bool fields (defaults true)
- providers/mod.rs: gated module declarations + new_with_config takes a
config snapshot and registers each provider behind its feature flag
Verification across feature axes:
- --no-default-features: 178 tests pass (feature-gated modules excluded)
- default (systemd only): 186 tests pass
- --features full: 233 tests pass (+55 from the 6 new conversions)
Tasks #6 and #7 complete.
Workspace shrinks from 2 members to 1. The daemon, IPC layer,
providers, config, frecency store, GTK4 UI, and CLI now live in a
single `crates/owlry` crate exposing both a library (so integration
tests can reach daemon types) and a binary.
Structural changes:
- crates/owlry-core/ deleted; all source moved into crates/owlry/src/
via git mv to preserve history
- crates/owlry/src/lib.rs added with module declarations
- crates/owlry/src/main.rs rewritten as thin entry that uses owlry::*
- crates/owlry/src/providers/mod.rs absorbs owlry-core's providers/mod.rs
and pulls dmenu into the same module tree
- All owlry_core:: refs in src/ rewritten to crate::
- All owlry_core:: refs in tests/ rewritten to owlry::
- systemd/owlryd.service: ExecStart=/usr/bin/owlry -d (single binary)
- justfile: drop owlry-core/owlry-lua/owlry-rune build steps; daemon
runs via 'cargo run -p owlry -- -d'
- owlry version: 1.0.10 -> 2.0.0-dev
Tests: 178 still pass (156 lib + 14 ipc + 8 server). No test changes
needed — moved files retained their inline test modules.
Task #2 complete.
Delete the entire dynamic-loading infrastructure that produced issue #5
and the per-API-bump plugin breakage cycle:
- crates/owlry-plugin-api/ (ABI-stable interface, gone)
- crates/owlry-lua/ (Lua runtime cdylib, gone — replaced by mlua in Phase 3)
- crates/owlry-rune/ (Rune runtime cdylib, gone per D3)
- owlry-core/src/plugins/ (loader, manifest, registry, watcher — all gone)
- owlry-core/src/providers/native_provider.rs
- owlry-core/src/providers/lua_provider.rs
- owlry-core/src/providers/config_editor.rs (per D11, 1127 LOC)
- owlry/src/plugin_commands.rs (per CLI restructure, 1296 LOC)
Provider trait gains submenu_actions(), execute_action(), prefix(),
icon(), position(), priority() as default methods so future built-in
providers can declare their UI metadata directly instead of relying on
the hardcoded match table.
ProviderManager simplified: drops native_providers,
static_native_providers, dynamic_providers, widget_providers,
runtimes, runtime_type_ids, plugin_registry fields and the
reload_runtimes / find_native_provider / get_widget_item /
widget_type_ids methods. ProviderPosition enum carries the Normal/
Widget distinction on the trait instead.
IPC Request::PluginList and Response::PluginList removed; Submenu
and PluginAction stay (route to Provider trait methods now).
owlry -d / --daemon flag added as the future daemon entry point; the
old owlryd binary is still produced from owlry-core for Phase 1
compatibility but will fold into the single binary in task #2.
Workspace shrinks from 5 members to 2. Tests: 142 passed.
LOC: -13,796 / +273 (net -13,523).
Tasks #3, #4, #5 complete.
reqwest 0.13 defaults to rustls -> aws-lc-rs which requires cmake/nasm
in minimal build environments (AUR chroot). Switch all direct reqwest
users to native-tls (system OpenSSL) to fix clean chroot build failures
reported by users.
Affected crates: owlry-core, owlry-lua, owlry-rune
PKGBUILD: add openssl to depends for all three runtime packages
Also add scripts/aur-local-test for clean chroot testing workflow
Search queries in daemon mode now run on a background thread via
DaemonHandle::query_async(). Results are posted back to the main
thread via glib::spawn_future_local + futures_channel::oneshot.
The GTK event loop is never blocked by IPC, eliminating perceived
input lag.
Local mode (dmenu) continues to use synchronous search since it
has no IPC overhead.