35f6501de2
Documentation, example config, and one validator-test fix. Version bump and AUR push intentionally deferred. data/owlry.example.lua (new): - Annotated reference config exercising every surface (set / providers / tabs / theme / profiles / provider / util). Active section is minimal and validates clean. aur/owlry/PKGBUILD: - Ships data/owlry.example.lua to /usr/share/doc/owlry/owlry.example.lua. pkgver kept at 2.0.1. README.md: - Config table puts owlry.lua first (preferred from 2.1), config.toml marked legacy/fallback with precedence note linking lua-api.md §2. - New "Quick Start (Lua config)" section with migrate-config blurb. - migrate-config row: [--force], deterministic. config validate row: exit 1 errors / exit 2 warnings. - Roadmap section flips Lua config from "lands in 2.1/3.0" to "shipped in 2.1"; lists 2.2 follow-ups (dynamic providers, owlry.bind, util.http_get). CLAUDE.md: - Project shape tree expands lua/ module with per-file descriptions. - Build section documents the `lua` cargo feature. - CLI shape line for migrate-config: [--force]. config validate: exit codes 1/2 mentioned. - New "Lua config layer (2.1+)" section covers precedence, the notify-based watcher, desktop-notification errors, and the Arc<Lua> / LoadedConfig invariants. data/owlry.1: - --profile mentions both owlry.profiles (lua) and [profiles.<NAME>] (toml). - config validate paragraph describes the categorised report and lists 0/1/2 exit codes. - migrate-config description no longer says "stub" — covers determinism, --force/-f, pre-v2 alias normalisation, links §9. - FILES adds ~/.config/owlry/owlry.lua and the example .lua; config.toml labelled legacy. ROADMAP.md: - "Lua-driven configuration" reworded as shipped in 2.1; example uses owlry.lua and the v2 API; 2.2 follow-ups listed. cli.rs help: migrate-config stub-era text → "TOML → owlry.lua (--force to overwrite)". lua/validate.rs: loosen pre_v2_aliases_are_known to assert only that aliases aren't flagged as unknown ids. is_clean() failed under --no-default-features --features lua because uuctl correctly triggered the compiled-out warning (uuctl → systemd, systemd feature off → silently dropped at runtime). Test matrix (all green): - --features full 352 lib tests - --no-default-features 182 lib tests - --no-default-features --features lua 305 lib tests Clippy silent in all three configurations. Smoke (release build, isolated XDG): 1. config validate on the shipped owlry.example.lua → OK exit 0 2. migrate-config: TOML → owlry.lua with the precedence notice 3. Daemon loads, watcher armed; appending owlry.provider triggers hot-reload within the debounce window 4. :phase310 prefix routes the empty query to the new provider 5. config validate against the live file still OK
145 lines
8.0 KiB
Lua
145 lines
8.0 KiB
Lua
-- ~/.config/owlry/owlry.lua — example configuration.
|
|
--
|
|
-- Drop this file in place to switch from config.toml to the Lua config
|
|
-- layer. owlry.lua takes precedence over config.toml when both exist
|
|
-- (info-logged at daemon start). The daemon watches this file and
|
|
-- hot-reloads on save; broken edits surface as desktop notifications
|
|
-- and keep the previous state alive.
|
|
--
|
|
-- Spec: https://somegit.dev/Owlibou/owlry/src/branch/main/docs/lua-api.md
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 1. Global settings.
|
|
-- Every key here is OPTIONAL — defaults apply for anything you omit.
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
owlry.set {
|
|
theme = "owl", -- bundled themes: owl, catppuccin-mocha,
|
|
-- nord, rose-pine, dracula, gruvbox-dark,
|
|
-- tokyo-night, solarized-dark, one-dark,
|
|
-- apex-neon. Plus any *.css under
|
|
-- ~/.config/owlry/themes/.
|
|
width = 850,
|
|
height = 650,
|
|
font_size = 14,
|
|
border_radius = 12,
|
|
-- terminal = "kitty", -- omit to auto-detect ($TERMINAL → xdg-
|
|
-- terminal-exec → DE-native → fallback).
|
|
use_uwsm = false, -- launch desktop entries via `uwsm app --`
|
|
-- for proper systemd session integration.
|
|
show_icons = true,
|
|
max_results = 100,
|
|
frecency = true, -- boost recently / frequently launched items
|
|
frecency_weight = 0.3, -- 0.0 = off, 1.0 = strong
|
|
search_engine = "duckduckgo", -- google | duckduckgo | bing |
|
|
-- startpage | searxng | brave |
|
|
-- ecosia, or a custom "{query}" URL.
|
|
}
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 2. Enabled providers.
|
|
-- Omit this call to enable every built-in provider (the default).
|
|
-- Listing a subset disables anything not mentioned. Pre-v2 aliases
|
|
-- (sys / system → power; uuctl → systemd) still work.
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
owlry.providers {
|
|
"app", "cmd", -- core launchers
|
|
"calc", "conv", -- = / > triggers
|
|
"power", -- shutdown / reboot / lock
|
|
"systemd", -- user units (:uuctl)
|
|
"ssh", "websearch", "filesearch", -- search-style providers
|
|
"emoji", "clipboard", -- pickers
|
|
}
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 3. Tab bar order (subset of providers).
|
|
-- Omit to give every enabled provider a tab. Order is preserved;
|
|
-- Ctrl+1 jumps to the first entry, Ctrl+2 the second, and so on.
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
owlry.tabs { "app", "cmd", "uuctl" }
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 4. Theme overrides.
|
|
-- owlry.theme("name") picks a bundled / user theme.
|
|
-- owlry.theme {} layers individual colour overrides on top.
|
|
-- Both forms compose — call as many times as you like.
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- owlry.theme {
|
|
-- background = "#1e1e2e",
|
|
-- background_secondary = "#313244",
|
|
-- border = "#45475a",
|
|
-- text = "#cdd6f4",
|
|
-- text_secondary = "#a6adc8",
|
|
-- accent = "#cba6f7",
|
|
-- accent_bright = "#f5c2e7",
|
|
-- -- Per-provider badges (each is optional):
|
|
-- badge_app = "#a6e3a1",
|
|
-- badge_cmd = "#fab387",
|
|
-- badge_power = "#f38ba8",
|
|
-- badge_uuctl = "#9ece6a",
|
|
-- }
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 5. Named profiles, selected by `owlry --profile <name>`.
|
|
-- Each profile overrides the default enabled-provider set for that
|
|
-- launch but inherits owlry.set / owlry.theme / owlry.tabs.
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- owlry.profiles {
|
|
-- dev = { "app", "cmd", "ssh" },
|
|
-- media = { "emoji", "clipboard" },
|
|
-- minimal = { "app" },
|
|
-- }
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 6. User-defined providers.
|
|
-- Register your own search source. Every field except `id` and
|
|
-- `items` is optional. `items` is called once at startup and the
|
|
-- results cached (dynamic per-keystroke providers land in 2.2).
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- owlry.provider {
|
|
-- id = "hs",
|
|
-- prefix = ":hs",
|
|
-- tab_label = "Shutdown",
|
|
-- icon = "system-shutdown",
|
|
-- search_noun = "shutdown actions",
|
|
-- items = function()
|
|
-- return {
|
|
-- { name = "Lock", command = "hyprlock" },
|
|
-- { name = "Shutdown", command = "systemctl poweroff" },
|
|
-- { name = "Reboot", command = "systemctl reboot" },
|
|
-- }
|
|
-- end,
|
|
-- }
|
|
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- 7. Host helpers (use inside provider `items` callbacks).
|
|
-- Available under owlry.util.*:
|
|
-- shell(cmd) -> string (stdout, trimmed)
|
|
-- shell_lines(cmd) -> {string}
|
|
-- read_file(path) -> string | nil
|
|
-- glob(pattern) -> {string} (~ expansion supported)
|
|
-- env(name, default?) -> string | nil
|
|
-- hostname() -> string
|
|
-- ──────────────────────────────────────────────────────────────────────
|
|
-- owlry.provider {
|
|
-- id = "docker-ps",
|
|
-- prefix = ":docker",
|
|
-- items = function()
|
|
-- local lines = owlry.util.shell_lines(
|
|
-- "docker ps --format '{{.Names}}\t{{.Image}}'"
|
|
-- )
|
|
-- local items = {}
|
|
-- for _, line in ipairs(lines) do
|
|
-- local name, image = line:match("([^\t]+)\t(.+)")
|
|
-- if name then
|
|
-- items[#items + 1] = {
|
|
-- name = name,
|
|
-- description = image,
|
|
-- command = "docker exec -it " .. name .. " bash",
|
|
-- terminal = true,
|
|
-- }
|
|
-- end
|
|
-- end
|
|
-- return items
|
|
-- end,
|
|
-- }
|